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

ruby-changes:13222

From: nobu <ko1@a...>
Date: Thu, 17 Sep 2009 14:33:51 +0900 (JST)
Subject: [ruby-changes:13222] Ruby:r24979 (ruby_1_8): * eval.c (rb_thread_start_0, rb_thread_start_1): should call start

nobu	2009-09-17 14:33:39 +0900 (Thu, 17 Sep 2009)

  New Revision: 24979

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

  Log:
    * eval.c (rb_thread_start_0, rb_thread_start_1): should call start
      timer after added new thread to thread list.  [ruby-core:25613]

  Modified files:
    branches/ruby_1_8/ChangeLog
    branches/ruby_1_8/eval.c

Index: ruby_1_8/ChangeLog
===================================================================
--- ruby_1_8/ChangeLog	(revision 24978)
+++ ruby_1_8/ChangeLog	(revision 24979)
@@ -1,3 +1,8 @@
+Thu Sep 17 14:33:37 2009  Nobuyoshi Nakada  <nobu@r...>
+
+	* eval.c (rb_thread_start_0, rb_thread_start_1): should call star
+	  timer after added new thread to thread list.  [ruby-core:25613]
+
 Thu Sep 17 06:25:32 2009  Marc-Andre Lafortune  <ruby-core@m...>
 
 	* lib/matrix.rb (Matrix#rank): Two bug fixes. One made
Index: ruby_1_8/eval.c
===================================================================
--- ruby_1_8/eval.c	(revision 24978)
+++ ruby_1_8/eval.c	(revision 24979)
@@ -12572,6 +12572,14 @@
 int rb_thread_tick = THREAD_TICK;
 #endif
 
+#if defined(HAVE_SETITIMER) || defined(_THREAD_SAFE)
+#define START_TIMER() (thread_init ? (void)0 : rb_thread_start_timer())
+#define STOP_TIMER() (rb_thread_stop_timer())
+#else
+#define START_TIMER() ((void)0)
+#define STOP_TIMER() ((void)0)
+#endif
+
 NORETURN(static void rb_thread_terminated _((rb_thread_t, int, enum rb_thread_status)));
 static VALUE rb_thread_yield _((VALUE, rb_thread_t));
 
@@ -12628,12 +12636,6 @@
 		 "can't start a new thread (frozen ThreadGroup)");
     }
 
-#if defined(HAVE_SETITIMER) || defined(_THREAD_SAFE)
-    if (!thread_init) {
-	rb_thread_start_timer();
-    }
-#endif
-
     if (THREAD_SAVE_CONTEXT(curr_thread)) {
 	return thread;
     }
@@ -12659,6 +12661,7 @@
     scope_dup(ruby_scope);
 
     thread_insert(th);
+    START_TIMER();
 
     PUSH_TAG(PROT_THREAD);
     if ((state = EXEC_TAG()) == 0) {
@@ -12752,6 +12755,7 @@
     *ruby_frame = *ip->frame;
     ruby_frame->prev = ip->frame;
     ruby_frame->iter = ITER_CUR;
+    START_TIMER();
     PUSH_TAG(PROT_NONE);
     if ((state = EXEC_TAG()) == 0) {
 	if (THREAD_SAVE_CONTEXT(th) == 0) {
@@ -13443,9 +13447,7 @@
     main_thread = curr_thread;
     curr_thread->next = curr_thread;
     curr_thread->prev = curr_thread;
-#if defined(HAVE_SETITIMER) || defined(_THREAD_SAFE)
-    rb_thread_stop_timer();
-#endif
+    STOP_TIMER();
 }
 
 

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

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