about summary refs log tree commit homepage
path: root/lib/yahns/server_mp.rb
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-10-09 02:24:44 +0000
committerEric Wong <e@yhbt.net>2021-10-09 03:35:44 +0000
commit88025df70e228fe9a9cf8676772eaa13aba68eb6 (patch)
tree57488eabc566c3de1e34a15647f9627084d70042 /lib/yahns/server_mp.rb
parent5df32f0b73dbec0f57192a80e3997eddfb2bf15e (diff)
downloadyahns-88025df70e228fe9a9cf8676772eaa13aba68eb6.tar.gz
This should prevent missed/delayed wakeups if repeatedly
kill(2)-ed.
Diffstat (limited to 'lib/yahns/server_mp.rb')
-rw-r--r--lib/yahns/server_mp.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/yahns/server_mp.rb b/lib/yahns/server_mp.rb
index 5467674..d56d1ed 100644
--- a/lib/yahns/server_mp.rb
+++ b/lib/yahns/server_mp.rb
@@ -157,7 +157,8 @@ module Yahns::ServerMP # :nodoc:
   def mp_sig_handle(watch, alive)
     # not performance critical
     watch.delete_if { |io| io.to_io.closed? }
-    if r = select(watch, nil, nil, alive ? nil : 0.1)
+    tout = alive ? (@sig_queue.empty? ? nil : 0) : 0.01
+    if r = select(watch, nil, nil, tout)
       r[0].each(&:yahns_step)
     end
     case @sig_queue.shift