method
close
v2_5_5 -
Show latest stable
-
0 notes -
Class: Queue
- 1_8_6_287
- 1_8_7_72
- 1_8_7_330
- 1_9_1_378
- 1_9_2_180
- 1_9_3_125
- 1_9_3_392
- 2_1_10
- 2_2_9
- 2_4_6 (0)
- 2_5_5 (2)
- 2_6_3 (38)
- What's this?
close()
public
Closes the queue. A closed queue cannot be re-opened.
After the call to close completes, the following are true:
-
closed? will return true
-
close will be ignored.
-
calling enq/push/<< will raise an exception.
-
when empty? is false, calling deq/pop/shift will return an object from the queue as usual.
ClosedQueueError is inherited from StopIteration, so that you can break loop block.
Example: q = Queue.new Thread.new{ while e = q.deq # wait for nil to break loop # ... end } q.close