Class: MessagePack::RPC::LoopUtil::TaskQueue
- Inherits:
-
Cool.io::AsyncWatcher
- Object
- Cool.io::AsyncWatcher
- MessagePack::RPC::LoopUtil::TaskQueue
- Defined in:
- lib/msgpack/rpc/loop.rb
Instance Method Summary collapse
-
#initialize ⇒ TaskQueue
constructor
A new instance of TaskQueue.
- #on_signal ⇒ Object
- #push(task) ⇒ Object
Constructor Details
#initialize ⇒ TaskQueue
Returns a new instance of TaskQueue.
43 44 45 46 |
# File 'lib/msgpack/rpc/loop.rb', line 43 def initialize @queue = [] super end |
Instance Method Details
#on_signal ⇒ Object
53 54 55 56 57 58 59 60 |
# File 'lib/msgpack/rpc/loop.rb', line 53 def on_signal while task = @queue.shift begin task.call rescue end end end |
#push(task) ⇒ Object
48 49 50 51 |
# File 'lib/msgpack/rpc/loop.rb', line 48 def push(task) @queue.push(task) signal end |