Class: Async::IO::Notification
- Inherits:
-
Object
- Object
- Async::IO::Notification
- Defined in:
- lib/async/io/notification.rb
Overview
A cross-reactor/process notification pipe.
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize ⇒ Notification
constructor
A new instance of Notification.
-
#signal ⇒ void
Signal to a given task that it should resume operations.
-
#wait ⇒ Object
Wait for signal to be called.
Constructor Details
#initialize ⇒ Notification
Returns a new instance of Notification.
12 13 14 15 16 17 18 |
# File 'lib/async/io/notification.rb', line 12 def initialize pipe = ::IO.pipe # We could call wait and signal from different reactors/threads/processes, so we don't create wrappers here, because they are not thread safe by design. @input = pipe.first @output = pipe.last end |
Instance Method Details
#close ⇒ Object
20 21 22 23 |
# File 'lib/async/io/notification.rb', line 20 def close @input.close @output.close end |