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 /ChangeLog | |
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 'ChangeLog')
-rw-r--r-- | ChangeLog | 31 |
1 files changed, 31 insertions, 0 deletions
@@ -1,3 +1,34 @@ +Thu Aug 27 07:45:34 2015 Koichi Sasada <ko1@atdot.net> + + * 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. + Wed Aug 26 10:52:02 2015 Nobuyoshi Nakada <nobu@ruby-lang.org> * re.c (rb_memsearch_wchar, rb_memsearch_qchar): test matching |