1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
Commit graph

3 commits

Author SHA1 Message Date
svn
8bf9687e6c * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-26 23:00:15 +00:00
ko1
fd7ac9f3c9 * 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
2015-08-26 22:59:32 +00:00
ko1
0de5e1cb87 * ext/thread/thread.c: move definitions of Queue, SizedQueue
and ConditionalVariables to thread_tools.c. In other wowrds,
  such classes are built-in.
  [Feature #8919]
  At first, I planned to embed only a Queue class.
  However, rubygems requires 'thread.rb' (rubygems are
  required at first, when launch MRI without --disable-gems).
  So most of people require 'thread.rb' as an embedded library.
  Now, ext/thread/thread.c is empty, only for a dummy for
  compatibility.
* thread.c: move a definition of Mutex class to thread_tools.c.
  And define Mutex class under Thread (so now Mutex is Thread::Mutex).
  Because other thread related classes are also defined under Thread.
  We remain ::Mutex as Thread::Mutex. Only an inspect result is changed.
* common.mk: add dependency from thread.o to thraed_tools.c.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51660 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-21 23:36:23 +00:00