Class: Moneta::Pool::Reply Private
- Inherits:
-
Object
- Object
- Moneta::Pool::Reply
- Defined in:
- lib/moneta/pool.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Attribute Summary collapse
- #resource ⇒ Object readonly private
Instance Method Summary collapse
-
#initialize(mutex) ⇒ Reply
constructor
private
A new instance of Reply.
- #resolve(value) ⇒ Object private
- #wait ⇒ Object private
Constructor Details
#initialize(mutex) ⇒ Reply
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Reply.
50 51 52 53 54 |
# File 'lib/moneta/pool.rb', line 50 def initialize(mutex) @mutex = mutex @resource = ::ConditionVariable.new @value = nil end |
Instance Attribute Details
#resource ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
48 49 50 |
# File 'lib/moneta/pool.rb', line 48 def resource @resource end |
Instance Method Details
#resolve(value) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
56 57 58 59 60 61 62 63 |
# File 'lib/moneta/pool.rb', line 56 def resolve(value) @mutex.synchronize do raise "Already resolved" if @value @value = value @resource.signal end nil end |
#wait ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
65 66 67 68 |
# File 'lib/moneta/pool.rb', line 65 def wait @resource.wait(@mutex) @value end |