summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-11-09 17:10:48 +0000
committerkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-11-09 17:10:48 +0000
commit871c6923dc32630e93f3483d9db1e547ac62a478 (patch)
tree2aff25712738d1e43e8e01f47d87f4af0fa9f351
parentc88d35619b79eda6f56fd912af4ddee762db10f5 (diff)
* 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/trunk@33693 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--thread_pthread.c14
2 files changed, 10 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index dc11d96b53..cc893f3e76 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Wed Nov 9 11:36:53 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread_pthread.c (gvl_yield): don't prevent concurrent sched_yield().
+ [Bug #5130] [ruby-core:38647]
+
Wed Nov 9 23:20:22 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
* io.c (rb_update_max_fd): fstat(2) can fail with other than
diff --git a/thread_pthread.c b/thread_pthread.c
index 7d03bcc561..7fa8e95ebd 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);