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

ruby-changes:27632

From: kosaki <ko1@a...>
Date: Sun, 10 Mar 2013 13:00:11 +0900 (JST)
Subject: [ruby-changes:27632] kosaki:r39684 (trunk): * thread_pthread.c (ubf_select): add to small comments why we

kosaki	2013-03-10 13:00:00 +0900 (Sun, 10 Mar 2013)

  New Revision: 39684

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

  Log:
    * thread_pthread.c (ubf_select): add to small comments why we
      need to call rb_thread_wakeup_timer_thread().

  Modified files:
    trunk/ChangeLog
    trunk/thread_pthread.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 39683)
+++ ChangeLog	(revision 39684)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Mar  6 22:56:14 2013  KOSAKI Motohiro  <kosaki.motohiro@g...>
+
+	* thread_pthread.c (ubf_select): add to small comments why we
+	  need to call rb_thread_wakeup_timer_thread().
+
 Wed Mar  6 21:42:24 2013  KOSAKI Motohiro  <kosaki.motohiro@g...>
 
 	* thread_pthread.c (rb_thread_create_timer_thread): factor out
Index: thread_pthread.c
===================================================================
--- thread_pthread.c	(revision 39683)
+++ thread_pthread.c	(revision 39684)
@@ -1098,8 +1098,16 @@ ubf_select(void *ptr) https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L1098
 {
     rb_thread_t *th = (rb_thread_t *)ptr;
     add_signal_thread_list(th);
+
+    /*
+     * ubf_select_each() doesn't guarantee to wake up the target thread.
+     * Therefore, we need to activate timer thread when called from
+     * Thread#kill etc.
+     * In the other hands, we shouldn't call rb_thread_wakeup_timer_thread()
+     * if running on timer thread because it may make endless wakeups.
+     */
     if (pthread_self() != timer_thread_id)
-	rb_thread_wakeup_timer_thread(); /* activate timer thread */
+	rb_thread_wakeup_timer_thread();
     ubf_select_each(th);
 }
 

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

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