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

ruby-changes:13828

From: usa <ko1@a...>
Date: Mon, 2 Nov 2009 12:58:44 +0900 (JST)
Subject: [ruby-changes:13828] Ruby:r25627 (trunk): * thread_{pthread,win32}.c (native_stop_timer_thread): join the thread

usa	2009-11-02 12:58:25 +0900 (Mon, 02 Nov 2009)

  New Revision: 25627

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

  Log:
    * thread_{pthread,win32}.c (native_stop_timer_thread): join the thread
      here.
    
    * thread_{pthread,win32}.c (native_reset_timer_thread): new function.
    
    * thread.c (rb_thread_stop_timer_thread, rb_thread_reset_timer_thread):
      call above function instead of simply seting 0.

  Modified files:
    trunk/ChangeLog
    trunk/thread.c
    trunk/thread_pthread.c
    trunk/thread_win32.c

Index: thread_win32.c
===================================================================
--- thread_win32.c	(revision 25626)
+++ thread_win32.c	(revision 25627)
@@ -564,10 +564,21 @@
 {
     int stopped = --system_working <= 0;
     if (stopped) {
+	SetEvent(timer_thread_lock);
+	native_thread_join(timer_thread_id);
 	CloseHandle(timer_thread_lock);
 	timer_thread_lock = 0;
     }
     return stopped;
 }
 
+static void
+native_reset_timer_thread(void)
+{
+    if (timer_thread_id) {
+	CloseHandle(timer_thread_id);
+	timer_thread_id = 0;
+    }
+}
+
 #endif /* THREAD_SYSTEM_DEPENDENT_IMPLEMENTATION */
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 25626)
+++ ChangeLog	(revision 25627)
@@ -1,3 +1,13 @@
+Mon Nov  2 12:55:50 2009  NAKAMURA Usaku  <usa@r...>
+
+	* thread_{pthread,win32}.c (native_stop_timer_thread): join the thread
+	  here.
+
+	* thread_{pthread,win32}.c (native_reset_timer_thread): new function.
+
+	* thread.c (rb_thread_stop_timer_thread, rb_thread_reset_timer_thread):
+	  call above function instead of simply seting 0.
+
 Mon Nov  2 11:22:19 2009  NARUSE, Yui  <naruse@r...>
 
 	* ext/dl/win32/lib/win32/registry.rb: update rdoc. [ruby-core:26022]
Index: thread_pthread.c
===================================================================
--- thread_pthread.c	(revision 25626)
+++ thread_pthread.c	(revision 25627)
@@ -816,9 +816,16 @@
 	native_cond_signal(&timer_thread_cond);
     }
     native_mutex_unlock(&timer_thread_lock);
+    native_thread_join(timer_thread_id);
     return stopped;
 }
 
+static void
+native_reset_timer_thread(void)
+{
+    timer_thread_id = 0;
+}
+
 #ifdef HAVE_SIGALTSTACK
 int
 ruby_stack_overflowed_p(const rb_thread_t *th, const void *addr)
Index: thread.c
===================================================================
--- thread.c	(revision 25626)
+++ thread.c	(revision 25627)
@@ -2651,15 +2651,14 @@
 rb_thread_stop_timer_thread(void)
 {
     if (timer_thread_id && native_stop_timer_thread()) {
-	native_thread_join(timer_thread_id);
-	timer_thread_id = 0;
+	native_reset_timer_thread();
     }
 }
 
 void
 rb_thread_reset_timer_thread(void)
 {
-    timer_thread_id = 0;
+    native_reset_timer_thread();
 }
 
 void

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

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