Class: CI::Queue::Redis::Base::State

Inherits:
Object
  • Object
show all
Defined in:
lib/ci/queue/redis/base.rb

Instance Method Summary collapse

Constructor Details

#initializeState

Returns a new instance of State.



294
295
296
297
298
# File 'lib/ci/queue/redis/base.rb', line 294

def initialize
  @state = nil
  @mutex = Mutex.new
  @cond = ConditionVariable.new
end

Instance Method Details

#set(*state) ⇒ Object



300
301
302
303
304
305
# File 'lib/ci/queue/redis/base.rb', line 300

def set(*state)
  @state = state
  @mutex.synchronize do
    @cond.broadcast
  end
end

#wait(timeout) ⇒ Object



307
308
309
310
311
312
# File 'lib/ci/queue/redis/base.rb', line 307

def wait(timeout)
  @mutex.synchronize do
    @cond.wait(@mutex, timeout)
  end
  @state
end