about summary refs log tree commit homepage
path: root/lib/yahns/queue_epoll.rb
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-10-09 02:24:45 +0000
committerEric Wong <e@yhbt.net>2021-10-09 03:35:45 +0000
commit8d44aa7c394d8b41af891a84e9b4fcca9358da41 (patch)
tree8912d302ced74146b66040d0c51064c05eb8bfe5 /lib/yahns/queue_epoll.rb
parent88025df70e228fe9a9cf8676772eaa13aba68eb6 (diff)
downloadyahns-8d44aa7c394d8b41af891a84e9b4fcca9358da41.tar.gz
epoll_wait() wakeups from QueueQuitter got lost during graceful
shutdown since there's multiple worker threads operating off the
same FD.  Workaround the problem by re-arming the eventfd for
every worker thread reaped.

Link: https://yhbt.net/lore/lkml/20210405231025.33829-1-dave@stgolabs.net/
Diffstat (limited to 'lib/yahns/queue_epoll.rb')
-rw-r--r--lib/yahns/queue_epoll.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/yahns/queue_epoll.rb b/lib/yahns/queue_epoll.rb
index 9e4271a..a198fbf 100644
--- a/lib/yahns/queue_epoll.rb
+++ b/lib/yahns/queue_epoll.rb
@@ -32,6 +32,10 @@ class Yahns::Queue < SleepyPenguin::Epoll::IO # :nodoc:
     epoll_ctl(Epoll::CTL_MOD, io, flags)
   end
 
+  def queue_del(io)
+    epoll_ctl(Epoll::CTL_DEL, io, 0)
+  end
+
   def thr_init
     Thread.current[:yahns_rbuf] = ''.dup
     Thread.current[:yahns_fdmap] = @fdmap