From dc8972b05ede0a3cb191397b1dc709f181c73cb3 Mon Sep 17 00:00:00 2001 From: ko1 Date: Sun, 7 Jan 2007 09:47:52 +0000 Subject: * 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: http://svn.ruby-lang.org/repos/ruby/trunk@11509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- thread.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'thread.c') diff --git a/thread.c b/thread.c index 5e0c92d44..d5dd8ae89 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 -- cgit