diff options
author | Eric Wong <normalperson@yhbt.net> | 2013-10-26 03:03:23 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2013-10-26 03:43:56 +0000 |
commit | a224a0bbb16aeed9a1420c6a770e723cf30a28b3 (patch) | |
tree | fcb30fb35bc4ac1f2b41801b897892465d334e97 /lib/yahns/queue_epoll.rb | |
parent | a28819801024dd88e93e2255f7210a66ea864c3e (diff) | |
download | yahns-a224a0bbb16aeed9a1420c6a770e723cf30a28b3.tar.gz |
This should help prevent some errors from popping up. Obviously, we cannot spend too long doing this inside a worker thread.
Diffstat (limited to 'lib/yahns/queue_epoll.rb')
-rw-r--r-- | lib/yahns/queue_epoll.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/yahns/queue_epoll.rb b/lib/yahns/queue_epoll.rb index c4a80a3..397df7a 100644 --- a/lib/yahns/queue_epoll.rb +++ b/lib/yahns/queue_epoll.rb @@ -22,10 +22,15 @@ class Yahns::Queue < SleepyPenguin::Epoll::IO # :nodoc: epoll_ctl(Epoll::CTL_ADD, io, flags) end + def thr_init + Thread.current[:yahns_rbuf] = "" + Thread.current[:yahns_fdmap] = @fdmap + end + # returns an array of infinitely running threads def worker_thread(logger, max_events) Thread.new do - Thread.current[:yahns_rbuf] = "" + thr_init begin epoll_wait(max_events) do |_, io| # don't care for flags for now case rv = io.yahns_step |