Class: CI::Queue::Redis::Base::State
- Inherits:
-
Object
- Object
- CI::Queue::Redis::Base::State
- Defined in:
- lib/ci/queue/redis/base.rb
Instance Method Summary collapse
-
#initialize ⇒ State
constructor
A new instance of State.
- #set(*state) ⇒ Object
- #wait(timeout) ⇒ Object
Constructor Details
#initialize ⇒ State
Returns a new instance of State.
327 328 329 330 331 |
# File 'lib/ci/queue/redis/base.rb', line 327 def initialize @state = nil @mutex = Mutex.new @cond = ConditionVariable.new end |
Instance Method Details
#set(*state) ⇒ Object
333 334 335 336 337 338 |
# File 'lib/ci/queue/redis/base.rb', line 333 def set(*state) @state = state @mutex.synchronize do @cond.broadcast end end |
#wait(timeout) ⇒ Object
340 341 342 343 344 345 |
# File 'lib/ci/queue/redis/base.rb', line 340 def wait(timeout) @mutex.synchronize do @cond.wait(@mutex, timeout) end @state end |