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

ruby-changes:25808

From: kosaki <ko1@a...>
Date: Mon, 26 Nov 2012 22:49:07 +0900 (JST)
Subject: [ruby-changes:25808] kosaki:r37865 (trunk): * thread.c (rb_thread_terminate_all): use native_sleep() instead

kosaki	2012-11-26 22:47:23 +0900 (Mon, 26 Nov 2012)

  New Revision: 37865

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

  Log:
    * thread.c (rb_thread_terminate_all): use native_sleep() instead
      of rb_thread_schedule(). Otherwise, it consume 100% cpu meaninglessly.
      [Bug #5368] [ruby-dev:44546]
    * thread.c (thread_start_func_2): last sub-thread wakes up main thread.

  Modified files:
    trunk/ChangeLog
    trunk/thread.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 37864)
+++ ChangeLog	(revision 37865)
@@ -1,3 +1,10 @@
+Mon Nov 26 22:44:24 2012  KOSAKI Motohiro  <kosaki.motohiro@g...>
+
+	* thread.c (rb_thread_terminate_all): use native_sleep() instead
+	  of rb_thread_schedule(). Otherwise, it consume 100% cpu meaninglessly.
+	  [Bug #5368] [ruby-dev:44546]
+	* thread.c (thread_start_func_2): last sub-thread wakes up main thread.
+
 Mon Nov 26 21:16:04 2012  KOSAKI Motohiro  <kosaki.motohiro@g...>
 
 	* vm_core.h (RUBY_VM_SET_TIMER_INTERRUPT, RUBY_VM_SET_INTERRUPT)
Index: thread.c
===================================================================
--- thread.c	(revision 37864)
+++ thread.c	(revision 37865)
@@ -385,7 +385,7 @@
     while (!rb_thread_alone()) {
 	PUSH_TAG();
 	if (EXEC_TAG() == 0) {
-	    rb_thread_schedule();
+	    native_sleep(th, 0);
 	}
 	else {
 	    /* ignore exception */
@@ -522,6 +522,9 @@
 	/* delete self other than main thread from living_threads */
 	if (th != main_th) {
 	    st_delete_wrap(th->vm->living_threads, th->self);
+	    if (rb_thread_alone()) {
+		rb_threadptr_interrupt(main_th);
+	    }
 	}
 
 	/* wake up joining threads */

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

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