mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
ext/thread: SizedQueue#max= wakes up waiters properly
* ext/thread/thread.c (rb_szqueue_max_set): use correct queue and limit wakeups. [Bug #9343][ruby-core:60517] * test/thread/test_queue.rb (test_sized_queue_assign_max): test for bug git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b9a4cf2aca
commit
2d603f9fee
3 changed files with 15 additions and 1 deletions
|
@ -437,7 +437,7 @@ rb_szqueue_max_set(VALUE self, VALUE vmax)
|
|||
diff = max - GET_SZQUEUE_ULONGMAX(self);
|
||||
}
|
||||
RSTRUCT_SET(self, SZQUEUE_MAX, vmax);
|
||||
while (diff > 0 && !NIL_P(t = rb_ary_shift(GET_QUEUE_QUE(self)))) {
|
||||
while (diff-- > 0 && !NIL_P(t = rb_ary_shift(GET_SZQUEUE_WAITERS(self)))) {
|
||||
rb_thread_wakeup_alive(t);
|
||||
}
|
||||
return vmax;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue