class Mutest::Actor::Receiver
Receiver
side of an actor
Public Instance Methods
call()
click to toggle source
Receives a message, blocking
@return [Object]
# File lib/mutest/actor/receiver.rb, line 11 def call 2.times do message = try_blocking_receive return message unless message.equal?(Undefined) end raise ProtocolError end
Private Instance Methods
try_blocking_receive()
click to toggle source
Try a blocking receive
@return [Undefined]
if there is no message yet
@return [Object]
if there is a message
# File lib/mutest/actor/receiver.rb, line 28 def try_blocking_receive mutex.synchronize do if messages.empty? condition_variable.wait(mutex) Undefined else messages.shift end end end