summaryrefslogtreecommitdiff
path: root/thread_pthread.c
diff options
context:
space:
mode:
authorkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-03-10 04:00:00 +0000
committerkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-03-10 04:00:00 +0000
commit0eeb116923171e73876d286e9573cb21cae057ae (patch)
treeb235fea48e392019df82bf56ee5657501f2814ad /thread_pthread.c
parent383a2579c3027e579f64e08597bae1097619baf4 (diff)
* thread_pthread.c (ubf_select): add to small comments why we
need to call rb_thread_wakeup_timer_thread(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread_pthread.c')
-rw-r--r--thread_pthread.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/thread_pthread.c b/thread_pthread.c
index c986f223c0..381647a7a7 100644
--- a/thread_pthread.c
+++ b/thread_pthread.c
@@ -1098,8 +1098,16 @@ ubf_select(void *ptr)
{
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);
}