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

ruby-changes:20274

From: ko1 <ko1@a...>
Date: Thu, 30 Jun 2011 17:27:21 +0900 (JST)
Subject: [ruby-changes:20274] ko1:r32322 (trunk): * thread_pthread.c (ping_signal_thread_list, thread_timer):

ko1	2011-06-30 17:27:13 +0900 (Thu, 30 Jun 2011)

  New Revision: 32322

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

  Log:
    * thread_pthread.c (ping_signal_thread_list, thread_timer):
      fix to keep polling state if there are any ping-tasks.

  Modified files:
    trunk/ChangeLog
    trunk/thread_pthread.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 32321)
+++ ChangeLog	(revision 32322)
@@ -1,3 +1,8 @@
+Thu Jun 30 17:25:08 2011  Koichi Sasada  <ko1@a...>
+
+	* thread_pthread.c (ping_signal_thread_list, thread_timer): 
+	  fix to keep polling state if there are any ping-tasks.
+
 Thu Jun 30 12:25:34 2011  Koichi Sasada  <ko1@a...>
 
 	* thread_pthread.c (rb_thread_create_timer_thread): allocate
Index: thread_pthread.c
===================================================================
--- thread_pthread.c	(revision 32321)
+++ thread_pthread.c	(revision 32322)
@@ -963,7 +963,7 @@
     ubf_select_each(th);
 }
 
-static void
+static int
 ping_signal_thread_list(void) {
     if (signal_thread_list_anchor.next) {
 	FGLOCK(&signal_thread_list_lock, {
@@ -975,13 +975,17 @@
 		list = list->next;
 	    }
 	});
+	return 1;
     }
+    else {
+	return 0;
+    }
 }
 #else /* USE_SIGNAL_THREAD_LIST */
 static void add_signal_thread_list(rb_thread_t *th) { }
 static void remove_signal_thread_list(rb_thread_t *th) { }
 #define ubf_select 0
-static void ping_signal_thread_list(void) { }
+static int ping_signal_thread_list(void) { return 0; }
 #endif /* USE_SIGNAL_THREAD_LIST */
 
 static pthread_t timer_thread_id;
@@ -1069,17 +1073,19 @@
 
     while (system_working > 0) {
 	fd_set rfds;
+	int need_polling;
 
 	/* timer function */
-	ping_signal_thread_list();
+	need_polling = ping_signal_thread_list();
 	timer_thread_function(0);
+
 	if (TT_DEBUG) WRITE_CONST(2, "tick\n");
 
 	/* wait */
 	FD_ZERO(&rfds);
 	FD_SET(timer_thread_pipe[0], &rfds);
 
-	if (gvl->waiting > 0) {
+	if (gvl->waiting > 0 || need_polling) {
 	    timeout.tv_sec = 0;
 	    timeout.tv_usec = TIME_QUANTUM_USEC;
 

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

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