diff options
author | kosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-01-03 00:09:21 +0000 |
---|---|---|
committer | kosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-01-03 00:09:21 +0000 |
commit | 8d82657abbc02ef63a0723f5a45efe42322cb8a4 (patch) | |
tree | 774c51b91c5f5e9afc629f324c958e9a207a1cf9 /thread_pthread.c | |
parent | 27fd7ee4a8ba8c971f56310f23570e7f7dfd8990 (diff) |
merge revision(s) 33693:
* thread_pthread.c (gvl_yield): don't prevent concurrent sched_yield().
[Bug #5130] [ruby-core:38647]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@34179 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread_pthread.c')
-rw-r--r-- | thread_pthread.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/thread_pthread.c b/thread_pthread.c index 7fa13e2a9c..255dbf02d2 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -109,16 +109,13 @@ gvl_yield(rb_vm_t *vm, rb_thread_t *th) goto acquire; } - vm->gvl.wait_yield = 1; - - if (vm->gvl.waiting > 0) - vm->gvl.need_yield = 1; - - if (vm->gvl.need_yield) { + if (vm->gvl.waiting > 0) { /* Wait until another thread task take GVL. */ - while (vm->gvl.need_yield) { + vm->gvl.need_yield = 1; + vm->gvl.wait_yield = 1; + while (vm->gvl.need_yield) native_cond_wait(&vm->gvl.switch_cond, &vm->gvl.lock); - } + vm->gvl.wait_yield = 0; } else { native_mutex_unlock(&vm->gvl.lock); @@ -126,7 +123,6 @@ gvl_yield(rb_vm_t *vm, rb_thread_t *th) native_mutex_lock(&vm->gvl.lock); } - vm->gvl.wait_yield = 0; native_cond_broadcast(&vm->gvl.switch_wait_cond); acquire: gvl_acquire_common(vm); |