Class: PbActor::Future
- Inherits:
-
Object
- Object
- PbActor::Future
- Defined in:
- lib/pb_actor/future.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.
3 4 5 6 7 |
# File 'lib/pb_actor/future.rb', line 3 def initialize id, wr, rd @id = id @wr= wr @rd = rd end |
Instance Method Details
#value ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/pb_actor/future.rb', line 9 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 |