class Queue
Constants
- CLOSE_MESSAGE
Public Instance Methods
close()
click to toggle source
# File lib/backports/2.3.0/queue/close.rb, line 33 def close @closed = true 2.times do Thread.pass num_waiting.times do push_without_close CLOSE_MESSAGE end end self end
closed?()
click to toggle source
# File lib/backports/2.3.0/queue/close.rb, line 44 def closed? !!defined?(@closed) end
pop_with_close(non_block = false)
click to toggle source
# File lib/backports/2.3.0/queue/close.rb, line 19 def pop_with_close(non_block = false) begin r = pop_without_close(non_block || closed?) r unless CLOSE_MESSAGE == r rescue ThreadError raise if non_block || !closed? end end
push_with_close(arg)
click to toggle source
# File lib/backports/2.3.0/queue/close.rb, line 10 def push_with_close(arg) raise ClosedQueueError, 'queue closed' if closed? push_without_close(arg) end