class QueueWithTimeout
Ждём сообщения в очередь, при наступлении таймаута (если указан) вкидываем nil.
Public Instance Methods
pop( tmout = nil )
click to toggle source
Calls superclass method
# File lib/queue-with-timeout.rb, line 6 def pop( tmout = nil ) if tmout.present? && tmout > 0 that = self dog = Thread.new { sleep tmout that << nil } end ret = super() dog.kill.join return ret end