about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-10-15 01:37:33 +0000
committerEric Wong <e@80x24.org>2015-10-15 18:46:17 +0000
commit4e42b60205ebb2ead8535e77658ccffb206346f1 (patch)
tree7ff037ec51ee7f732138a3be5c10b0edca7123ee
parent98819daf5c638fec4d20bb3960e0d3188e772ab8 (diff)
WriterThreadPool, WriterThreadSpawn, Base, and potentially
other rarely-used concurrency options experienced slow shutdowns
due to the destruction of a listener socket failing to wake up
a thread in IO.select.

Send ourselves a signal to interrupt the IO.select call in
the main thread to force the wakeup.
-rw-r--r--lib/rainbows.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/rainbows.rb b/lib/rainbows.rb
index 3bebf34..0af5620 100644
--- a/lib/rainbows.rb
+++ b/lib/rainbows.rb
@@ -93,6 +93,9 @@ module Rainbows
       @readers.clear
       tmp.each { |s| s.close rescue nil }.clear
       @at_quit.each { |task| task.call }
+
+      # XXX hack to break out of IO.select in worker_loop for some models
+      Process.kill(:QUIT, $$)
     end
     false
   end