Class: PbActor::Future
- Inherits:
-
Object
- Object
- PbActor::Future
- Defined in:
- lib/pb_actor/proxy.rb
Instance Method Summary collapse
-
#initialize(id, wr, rd) ⇒ Future
constructor
A new instance of Future.
- #value ⇒ Object
Constructor Details
#initialize(id, wr, rd) ⇒ Future
Returns a new instance of Future.
131 132 133 134 135 |
# File 'lib/pb_actor/proxy.rb', line 131 def initialize id, wr, rd @id = id @wr= wr @rd = rd end |
Instance Method Details
#value ⇒ Object
137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/pb_actor/proxy.rb', line 137 def value loop do Message.send [:future_value_get, @id], @wr type, value = Message.recv @rd if type == :future_value break value else sleep 0.01 end end end |