mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* thread_sync.c (queue_do_close): ignore multiple close to allow
multiple producers. https://bugs.ruby-lang.org/issues/10600#note-14 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51732 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
09b422505c
commit
c37c67cef8
2 changed files with 22 additions and 14 deletions
|
@ -1,3 +1,9 @@
|
|||
Tue Sep 1 18:16:32 2015 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* thread_sync.c (queue_do_close): ignore multiple close to allow
|
||||
multiple producers.
|
||||
https://bugs.ruby-lang.org/issues/10600#note-14
|
||||
|
||||
Tue Sep 1 18:06:26 2015 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* thread_tools.c: rename thread_tools.c to thread_sync.c.
|
||||
|
|
|
@ -619,23 +619,23 @@ queue_do_close(VALUE self, int argc, VALUE *argv, int is_szq)
|
|||
{
|
||||
VALUE exception = Qfalse;
|
||||
|
||||
if (queue_closed_p(self)) raise_closed_queue_error(self);
|
||||
if (!queue_closed_p(self)) {
|
||||
rb_scan_args(argc, argv, "01", &exception);
|
||||
FL_SET(self, QUEUE_CLOSED);
|
||||
|
||||
rb_scan_args(argc, argv, "01", &exception);
|
||||
FL_SET(self, QUEUE_CLOSED);
|
||||
if (RTEST(exception)) {
|
||||
FL_SET(self, QUEUE_CLOSE_EXCEPTION);
|
||||
}
|
||||
|
||||
if (RTEST(exception)) {
|
||||
FL_SET(self, QUEUE_CLOSE_EXCEPTION);
|
||||
}
|
||||
if (queue_num_waiting(self) > 0) {
|
||||
VALUE waiters = GET_QUEUE_WAITERS(self);
|
||||
wakeup_all_threads(waiters);
|
||||
}
|
||||
|
||||
if (queue_num_waiting(self) > 0) {
|
||||
VALUE waiters = GET_QUEUE_WAITERS(self);
|
||||
wakeup_all_threads(waiters);
|
||||
}
|
||||
|
||||
if (is_szq && szqueue_num_waiting_producer(self) > 0) {
|
||||
VALUE waiters = GET_SZQUEUE_WAITERS(self);
|
||||
wakeup_all_threads(waiters);
|
||||
if (is_szq && szqueue_num_waiting_producer(self) > 0) {
|
||||
VALUE waiters = GET_SZQUEUE_WAITERS(self);
|
||||
wakeup_all_threads(waiters);
|
||||
}
|
||||
}
|
||||
|
||||
return self;
|
||||
|
@ -705,6 +705,8 @@ queue_do_push(VALUE self, VALUE obj)
|
|||
*
|
||||
* - +closed?+ will return true
|
||||
*
|
||||
* - +close+ will be ignored.
|
||||
*
|
||||
* - calling enq/push/<< will raise ClosedQueueError('queue closed')
|
||||
*
|
||||
* - when +empty?+ is false, calling deq/pop/shift will return an object
|
||||
|
|
Loading…
Reference in a new issue