[ruby-cvs:58847] ko1:r51699 (trunk): * thread_tools.c: add Queue#close(exception=false) and

ko1 at ruby-lang.org ko1 at ruby-lang.org
Thu Aug 27 07:59:33 JST 2015

ko1	2015-08-27 07:59:32 +0900 (Thu, 27 Aug 2015)

  New Revision: 51699


    * thread_tools.c: add Queue#close(exception=false) and
      [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
    * test/thread/test_queue.rb: add tests originally written by
      John Anderson and modify detailed behavior.

  Modified files:

More information about the ruby-cvs mailing list