Project

General

Profile

« Previous | Next » 

Revision fd7ac9f3

Added by ko1 (Koichi Sasada) over 8 years ago

  • 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