diff options
author | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-07-30 18:53:46 +0000 |
---|---|---|
committer | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-07-30 18:53:46 +0000 |
commit | eda3556ea1c742a7c425db465b9a7d8db5577fe4 (patch) | |
tree | d082ba13f9752e78e8b0978a6aa1d41f908519c1 /thread_pthread.c | |
parent | 74a126b5c5cf16ad2d0fb923ef02bbd5f7330221 (diff) | |
download | ruby-eda3556ea1c742a7c425db465b9a7d8db5577fe4.tar.gz |
thread_pthread.c (gvl_yield): do ubf wakeups when uncontended
Not having contention for GVL could mean everybody else is stuck
in blocking region without GVL, so we kick the ubf list in that
case.
I expect this to fix test_thread_fd_close timeout:
http://ci.rvm.jp/results/trunk-test@ruby-sky3/1173398
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64133 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread_pthread.c')
-rw-r--r-- | thread_pthread.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/thread_pthread.c b/thread_pthread.c index d09569ec7d..844a4bc800 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -194,6 +194,12 @@ gvl_yield(rb_vm_t *vm, rb_thread_t *th) } else { rb_native_mutex_unlock(&vm->gvl.lock); + /* + * GVL was not contended when we released, so we have no potential + * contenders for reacquisition. Perhaps they are stuck in blocking + * region w/o GVL, too, so we kick them: + */ + ubf_wakeup_all_threads(); native_thread_yield(); rb_native_mutex_lock(&vm->gvl.lock); rb_native_cond_broadcast(&vm->gvl.switch_wait_cond); |