summaryrefslogtreecommitdiff
path: root/thread_pthread.c
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-12-22 13:45:58 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-12-22 13:45:58 +0000
commitb288aa2d89c2f5b2ce771cfe5531e4e2960208ae (patch)
tree8a6246d4eccaab15b9f1dddbb79ef553488dc27c /thread_pthread.c
parentafbcfdf96184fc5548bb697ba513785e7891981d (diff)
* thread_pthread.c (ping_signal_thread_list): remove return value.
* thread_pthread.c (check_signal_thread_list): add a new function to check if signal thread list is empty. * thread_pthread.c (thread_timer): check signal thread list after timer_thread_function(). main thread might be added into signal thread list during timer_thread_function(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34099 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread_pthread.c')
-rw-r--r--thread_pthread.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/thread_pthread.c b/thread_pthread.c
index c1a76d70f2..52997ecbf5 100644
--- a/thread_pthread.c
+++ b/thread_pthread.c
@@ -1024,7 +1024,7 @@ ubf_select(void *ptr)
ubf_select_each(th);
}
-static int
+static void
ping_signal_thread_list(void) {
if (signal_thread_list_anchor.next) {
FGLOCK(&signal_thread_list_lock, {
@@ -1036,17 +1036,23 @@ ping_signal_thread_list(void) {
list = list->next;
}
});
- return 1;
}
- else {
+}
+
+static int
+check_signal_thread_list(void)
+{
+ if (signal_thread_list_anchor.next)
+ return 1;
+ else
return 0;
- }
}
#else /* USE_SIGNAL_THREAD_LIST */
#define add_signal_thread_list(th) (void)(th)
#define remove_signal_thread_list(th) (void)(th)
#define ubf_select 0
-static int ping_signal_thread_list(void) { return 0; }
+static void ping_signal_thread_list(void) { return; }
+static int check_signal_thread_list(void) { return 0; }
#endif /* USE_SIGNAL_THREAD_LIST */
static int timer_thread_pipe[2] = {-1, -1};
@@ -1140,8 +1146,9 @@ thread_timer(void *p)
int need_polling;
/* timer function */
- need_polling = ping_signal_thread_list();
+ ping_signal_thread_list();
timer_thread_function(0);
+ need_polling = check_signal_thread_list();
if (TT_DEBUG) WRITE_CONST(2, "tick\n");