summaryrefslogtreecommitdiff
path: root/thread_pthread.ci
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-01-07 09:47:52 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-01-07 09:47:52 +0000
commit84f8da11579b8b655505dc8abffc31c715784794 (patch)
treeac14d594c13c1f4de3aa1e79aece9f330d76a10c /thread_pthread.ci
parent4e4eec7016037f051a6d1173bb5829de9c4840c3 (diff)
* thread.c (rb_thread_stop_timer_thread(), rb_thread_reset_timer_thread(),
rb_thread_start_timer_thread()): added. * thread_pthread.ci: add a native_thread_join() and move rb_thread_reset_timer_thread() definition to thread.c. * thread_win32.ci: ditto * process.c: fix before_exec(), after_exec() to stop timer thread (and restart timer thread if exec failed). and fix to reset timer thread information when forked child process starts (to fix [ruby-core:09822]). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread_pthread.ci')
-rw-r--r--thread_pthread.ci17
1 files changed, 9 insertions, 8 deletions
diff --git a/thread_pthread.ci b/thread_pthread.ci
index 3a3249e531..fe7086dc61 100644
--- a/thread_pthread.ci
+++ b/thread_pthread.ci
@@ -206,6 +206,15 @@ native_thread_create(yarv_thread_t *th)
}
static void
+native_thread_join(pthread_t th)
+{
+ int err = pthread_join(th, 0);
+ if (err) {
+ rb_raise(rb_eThreadError, "native_thread_join() failed (%d)", err);
+ }
+}
+
+static void
native_thread_apply_priority(yarv_thread_t *th)
{
struct sched_param sp;
@@ -430,7 +439,6 @@ rb_thread_create_timer_thread(void)
#ifdef PTHREAD_STACK_MIN
pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN);
#endif
- pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
err = pthread_create(&timer_thread_id, &attr, thread_timer, 0);
if (err != 0) {
rb_bug("rb_thread_create_timer_thread: return non-zero (%d)", err);
@@ -439,11 +447,4 @@ rb_thread_create_timer_thread(void)
rb_disable_interrupt(); /* only timer thread recieve signal */
}
-void
-rb_thread_reset_timer_thread(void)
-{
- timer_thread_id = 0;
- rb_thread_create_timer_thread();
-}
-
#endif /* THREAD_SYSTEM_DEPENDENT_IMPLEMENTATION */