Class: Concurrent::Condition::Result
- Inherits:
-
Object
- Object
- Concurrent::Condition::Result
- Defined in:
- lib/concurrent/atomic/condition.rb
Instance Attribute Summary collapse
-
#remaining_time ⇒ Object
readonly
Returns the value of attribute remaining_time.
Instance Method Summary collapse
-
#initialize(remaining_time) ⇒ Result
constructor
A new instance of Result.
-
#timed_out? ⇒ Boolean
True if current thread has been waken up due to a timeout, otherwise false.
-
#woken_up? ⇒ Boolean
(also: #can_wait?)
True if current thread has been waken up by a #signal or a #broadcast call, otherwise false.
Constructor Details
#initialize(remaining_time) ⇒ Result
Returns a new instance of Result.
14 15 16 |
# File 'lib/concurrent/atomic/condition.rb', line 14 def initialize(remaining_time) @remaining_time = remaining_time end |
Instance Attribute Details
#remaining_time ⇒ Object (readonly)
Returns the value of attribute remaining_time.
18 19 20 |
# File 'lib/concurrent/atomic/condition.rb', line 18 def remaining_time @remaining_time end |
Instance Method Details
#timed_out? ⇒ Boolean
Returns true if current thread has been waken up due to a timeout, otherwise false.
26 27 28 |
# File 'lib/concurrent/atomic/condition.rb', line 26 def timed_out? @remaining_time != nil && @remaining_time <= 0 end |
#woken_up? ⇒ Boolean Also known as: can_wait?
Returns true if current thread has been waken up by a #signal or a #broadcast call, otherwise false.
21 22 23 |
# File 'lib/concurrent/atomic/condition.rb', line 21 def woken_up? @remaining_time.nil? || @remaining_time > 0 end |