summaryrefslogtreecommitdiff
path: root/thread_pthread.c
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-06-20 23:38:21 (GMT)
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-06-20 23:38:21 (GMT)
commit48efa44719d03eb067d27b30c68cf821074aedce (patch)
tree153f2f0fd2c57cb76dc9644c408d44ca970673d8 /thread_pthread.c
parent6c83a3ab60c5d2a98842bc5bdf76fc3df598441d (diff)
thread_pthread.c: fix non-sleepy timer-thread with fork
This fixes bootstraptest/test_fork.rb for systems with sleepy timer thread disabled. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63709 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread_pthread.c')
-rw-r--r--thread_pthread.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/thread_pthread.c b/thread_pthread.c
index 78c66a0..40cb601 100644
--- a/thread_pthread.c
+++ b/thread_pthread.c
@@ -975,7 +975,6 @@ native_thread_create(rb_thread_t *th)
return err;
}
-#if USE_SLEEPY_TIMER_THREAD
static void
native_thread_join(pthread_t th)
{
@@ -984,8 +983,6 @@ native_thread_join(pthread_t th)
rb_raise(rb_eThreadError, "native_thread_join() failed (%d)", err);
}
}
-#endif
-
#if USE_NATIVE_THREAD_PRIORITY
@@ -1622,8 +1619,8 @@ native_stop_timer_thread(void)
stopped = --system_working <= 0;
if (TT_DEBUG) fprintf(stderr, "stop timer thread\n");
-#if USE_SLEEPY_TIMER_THREAD
if (stopped) {
+#if USE_SLEEPY_TIMER_THREAD
/* prevent wakeups from signal handler ASAP */
timer_thread_pipe.owner_process = 0;
@@ -1639,18 +1636,20 @@ native_stop_timer_thread(void)
/* stop writing ends of pipes so timer thread notices EOF */
CLOSE_INVALIDATE(normal[1]);
CLOSE_INVALIDATE(low[1]);
+#endif
/* timer thread will stop looping when system_working <= 0: */
native_thread_join(timer_thread.id);
+#if USE_SLEEPY_TIMER_THREAD
/* timer thread will close the read end on exit: */
VM_ASSERT(timer_thread_pipe.normal[0] == -1);
VM_ASSERT(timer_thread_pipe.low[0] == -1);
+#endif
if (TT_DEBUG) fprintf(stderr, "joined timer thread\n");
timer_thread.created = 0;
}
-#endif
return stopped;
}