diff options
| author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-08-26 22:59:32 +0000 |
|---|---|---|
| committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-08-26 22:59:32 +0000 |
| commit | fd7ac9f3c9e106a57869da762a383536636f0f3d (patch) | |
| tree | 789de6699e492fc58b26531147b4c6065d4a7db5 /include/ruby | |
| parent | b79d7910f5721b222443464ca576c5774c1a79ef (diff) | |
* thread_tools.c: add Queue#close(exception=false) and
SizedQueue#close(exception=false).
[Feature #10600]
Trying to deq from a closed empty queue return nil
if exception parameter equals to false (default).
If exception parameter is truthy, it raises
ClosedQueueError (< StopIteration).
ClosedQueueError inherits StopIteration so that you can write:
loop{ e = q.deq; (using e) }
Trying to close a closed queue raises ClosedQueueError.
Blocking threads to wait deq for Queue and SizedQueue will be
restarted immediately by returning nil (exception=false) or
raising a ClosedQueueError (exception=true).
Blocking threads to wait enq for SizedQueue will be
restarted by raising a ClosedQueueError immediately.
The above specification is not proposed specification, so that
we need to continue discussion to conclude specification this
method.
* test/thread/test_queue.rb: add tests originally written by
John Anderson and modify detailed behavior.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51699 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'include/ruby')
0 files changed, 0 insertions, 0 deletions
