[前][次][番号順一覧][スレッド一覧]

ruby-changes:21644

From: kosaki <ko1@a...>
Date: Thu, 10 Nov 2011 02:11:01 +0900 (JST)
Subject: [ruby-changes:21644] kosaki:r33693 (trunk): * thread_pthread.c (gvl_yield): don't prevent concurrent sched_yield().

kosaki	2011-11-10 02:10:48 +0900 (Thu, 10 Nov 2011)

  New Revision: 33693

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=33693

  Log:
    * thread_pthread.c (gvl_yield): don't prevent concurrent sched_yield().
      [Bug #5130] [ruby-core:38647]

  Modified files:
    trunk/ChangeLog
    trunk/thread_pthread.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 33692)
+++ ChangeLog	(revision 33693)
@@ -1,3 +1,8 @@
+Wed Nov  9 11:36:53 2011  KOSAKI Motohiro  <kosaki.motohiro@g...>
+
+	* 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@r...>
 
 	* io.c (rb_update_max_fd): fstat(2) can fail with other than
Index: thread_pthread.c
===================================================================
--- thread_pthread.c	(revision 33692)
+++ thread_pthread.c	(revision 33693)
@@ -109,16 +109,13 @@
 	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 @@
 	native_mutex_lock(&vm->gvl.lock);
     }
 
-    vm->gvl.wait_yield = 0;
     native_cond_broadcast(&vm->gvl.switch_wait_cond);
   acquire:
     gvl_acquire_common(vm);

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]