summaryrefslogtreecommitdiff
path: root/thread.c
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.c
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.c')
-rw-r--r--thread.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/thread.c b/thread.c
index 5e0c92d44f..d5dd8ae895 100644
--- a/thread.c
+++ b/thread.c
@@ -65,7 +65,7 @@ NOINLINE(void yarv_set_stack_end(VALUE **stack_end_p));
static VALUE eKillSignal = INT2FIX(0);
static VALUE eTerminateSignal = INT2FIX(1);
-static int system_working = 1;
+static volatile int system_working = 1;
inline static void
st_delete_wrap(st_table * table, VALUE key)
@@ -1602,6 +1602,27 @@ timer_thread_function(void)
}
}
+void
+rb_thread_stop_timer_thread(void)
+{
+ if (timer_thread_id) {
+ system_working = 0;
+ native_thread_join(timer_thread_id);
+ }
+}
+
+void
+rb_thread_reset_timer_thread(void)
+{
+ timer_thread_id = 0;
+}
+
+void
+rb_thread_start_timer_thread(void)
+{
+ rb_thread_create_timer_thread();
+}
+
/***/
void