about summary refs log tree commit homepage
path: root/lib/yahns/queue_epoll.rb
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-06-07 04:07:17 +0000
committerEric Wong <e@80x24.org>2016-06-07 04:07:38 +0000
commit77aac8c54ac030b08cfe6bcafc6fd155854456a7 (patch)
treeb1cf48b73a51aa51f54f7c49a497624f8f9df289 /lib/yahns/queue_epoll.rb
parent6c2531dd6fca28d24dc521ee6fedc4dc11e54e04 (diff)
downloadyahns-77aac8c54ac030b08cfe6bcafc6fd155854456a7.tar.gz
Using a high max_events may mean some IO objects are closed
after they're retrieved from the kernel but before our Ruby
process has had a chance to get to them.
Diffstat (limited to 'lib/yahns/queue_epoll.rb')
-rw-r--r--lib/yahns/queue_epoll.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/yahns/queue_epoll.rb b/lib/yahns/queue_epoll.rb
index 6d8a6ca..7f5c038 100644
--- a/lib/yahns/queue_epoll.rb
+++ b/lib/yahns/queue_epoll.rb
@@ -44,6 +44,7 @@ class Yahns::Queue < SleepyPenguin::Epoll::IO # :nodoc:
       thr_init
       begin
         epoll_wait(max_events) do |_, io| # don't care for flags for now
+          next if io.closed?
 
           # Note: we absolutely must not do anything with io after
           # we've called epoll_ctl on it, io is exclusive to this