Exception: ImprovedQueue::UnblockError
- Inherits:
-
StopIteration
- Object
- StopIteration
- ImprovedQueue::UnblockError
- Defined in:
- lib/improved-queue.rb
Overview
The queue will raise this class of error within each waiting thread you wish to unblock, upon calling the #unblock_deq, #unblock_enq or #unblock_waiting methods. It inherits from StopIteration, so you can take advantage of the implicit rescue clause in Kernel.loop if you wish, like so:
queue = ImprovedQueue.new 10
thread1 = Thread.new do
loop do
queue.pop
end
end
thread2 = Thread.new do
queue.unblock_deq thread1
end