Class | EventMachine::Channel |
In: |
lib/em/channel.rb
|
Parent: | Object |
Provides a simple thread-safe way to transfer data between (typically) long running tasks in {EventMachine.defer} and event loop thread.
@example
channel = EventMachine::Channel.new sid = channel.subscribe { |msg| p [:got, msg] } channel.push('hello world') channel.unsubscribe(sid)
Takes any arguments suitable for EM::Callback() and returns a subscriber id for use when unsubscribing.
@return [Integer] Subscribe identifier @see unsubscribe
Removes subscriber from the list.
@param [Integer] Subscriber identifier @see subscribe