Method: Wakame::MasterManagers::LockQueue#wait

Defined in:
lib/wakame/master_managers/action_manager.rb

#wait(id, tout = 60*30) ⇒ Object



261
262
263
264
265
266
267
268
269
270
271
272
# File 'lib/wakame/master_managers/action_manager.rb', line 261

def wait(id, tout=60*30)
  @qbt_m.synchronize { @queue_by_thread[Thread.current] = ::Queue.new }

  timeout(tout) {
    while test(id) == :wait
      Wakame.log.debug("#{self.class}: Job #{id} waits for locked resouces: #{@id2res[id].keys.join(', ')}")
      break if id == @queue_by_thread[Thread.current].deq
    end
  }
ensure
  @qbt_m.synchronize { @queue_by_thread.delete(Thread.current) }
end