Class: ThreadStorm::Sentinel
Instance Attribute Summary collapse
-
#e_cond ⇒ Object
readonly
Returns the value of attribute e_cond.
-
#p_cond ⇒ Object
readonly
Returns the value of attribute p_cond.
Instance Method Summary collapse
-
#initialize ⇒ Sentinel
constructor
A new instance of Sentinel.
- #synchronize ⇒ Object
Constructor Details
#initialize ⇒ Sentinel
Returns a new instance of Sentinel.
7 8 9 10 11 |
# File 'lib/thread_storm/sentinel.rb', line 7 def initialize @lock = Monitor.new @e_cond = @lock.new_cond # execute condition @p_cond = @lock.new_cond # pop condition end |
Instance Attribute Details
#e_cond ⇒ Object (readonly)
Returns the value of attribute e_cond.
5 6 7 |
# File 'lib/thread_storm/sentinel.rb', line 5 def e_cond @e_cond end |
#p_cond ⇒ Object (readonly)
Returns the value of attribute p_cond.
5 6 7 |
# File 'lib/thread_storm/sentinel.rb', line 5 def p_cond @p_cond end |
Instance Method Details
#synchronize ⇒ Object
13 14 15 |
# File 'lib/thread_storm/sentinel.rb', line 13 def synchronize @lock.synchronize{ yield(@e_cond, @p_cond) } end |