Class: EventMachine::SpawnedProcess
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/em/spawnable.rb |
Overview
Support for Erlang-style processes.
Instance Method Summary
-
#notify(*x)
(also: #resume, #run)
Send a message to the spawned process.
-
#resume(*x)
Alias for #notify.
-
#run(*x)
Alias for #notify.
- #set_receiver(blk)
Instance Method Details
#notify(*x) Also known as: #resume, #run
Send a message to the spawned process
# File 'lib/em/spawnable.rb', line 31
def notify *x me = self EM.next_tick { # A notification executes in the context of this # SpawnedProcess object. That makes self and notify # work as one would expect. # y = me.call(*x) if y and y.respond_to?(:pull_out_yield_block) a,b = y.pull_out_yield_block set_receiver a self.notify if b end } end
#resume(*x)
Alias for #notify.
# File 'lib/em/spawnable.rb', line 46
alias_method :resume, :notify
#run(*x)
Alias for #notify.
# File 'lib/em/spawnable.rb', line 47
alias_method :run, :notify # for formulations like (EM.spawn {xxx}).run
#set_receiver(blk)
[ GitHub ]# File 'lib/em/spawnable.rb', line 49
def set_receiver blk (class << self ; self ; end).class_eval do remove_method :call if method_defined? :call define_method :call, blk end end