mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
thread_pthread.c (ubf_select): refix [Bug #5343]
We still need to to designate a timer thread after registering target thread for the ubf list. Oops :x Note: I was never able to reproduce test/thread/test_queue.rb::test_thr_kill failures on my on Debian machines. [ruby-core:88088] [Misc #14937] [Bug #5343] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64108 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
708bfd2115
commit
4c1ab82f06
1 changed files with 17 additions and 0 deletions
|
@ -1172,8 +1172,25 @@ static void
|
|||
ubf_select(void *ptr)
|
||||
{
|
||||
rb_thread_t *th = (rb_thread_t *)ptr;
|
||||
rb_vm_t *vm = th->vm;
|
||||
|
||||
register_ubf_list(th);
|
||||
|
||||
/*
|
||||
* ubf_wakeup_thread() doesn't guarantee to wake up a target thread.
|
||||
* Therefore, we repeatedly call ubf_wakeup_thread() until a target thread
|
||||
* exit from ubf function. We must designate a timer-thread to perform
|
||||
* this operation.
|
||||
*/
|
||||
rb_native_mutex_lock(&vm->gvl.lock);
|
||||
if (!vm->gvl.timer) {
|
||||
native_thread_data_t *last;
|
||||
|
||||
last = list_tail(&vm->gvl.waitq, native_thread_data_t, ubf_list);
|
||||
if (last) rb_native_cond_signal(&last->sleep_cond);
|
||||
}
|
||||
rb_native_mutex_unlock(&vm->gvl.lock);
|
||||
|
||||
ubf_wakeup_thread(th);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue