From 2015069a204e8ba13709f94aed5e4341ea297728 Mon Sep 17 00:00:00 2001 From: yugui Date: Sun, 30 Nov 2008 09:22:31 +0000 Subject: * thread.c, thread_pthread.c, thread_win32.c: merges nobu's commits - r20117, r20123, r20124, r20127, r20132-r20134, r20138, r20140, r20141 and r20160 - from trunk into ruby_1_9_1. * thread_pthread.c (thread_timer): checks working flags again. * thread_pthread.c (rb_thread_create_timer_thread): do not wait never coming signal if failed to create tiemr thread. * thread_pthread.c (native_cond_timedwait): returns error code. * thread_pthread.c (thread_timer, rb_thread_create_timer_thread): handshakes properly. * thread_pthread.c (thread_timer): initializes mutex each time. * thread_win32.c (thread_start_func_1): use already gotten stack info. * thread.c (thread_timer): pthread_cond_timedwait returns ETIMEDOUT when timed out. * thread_pthread.c (thread_timer): uses pthread_cond_timedwait always instead of pthread_kill. * thread.c (thread_timer): uses timedwait on cygwin. * thread.c (rb_thread_stop_timer_thread): terminates timer thread immediately. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@20407 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- thread.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'thread.c') diff --git a/thread.c b/thread.c index dad5c1c286..b9f7a28cd8 100644 --- a/thread.c +++ b/thread.c @@ -71,6 +71,7 @@ static void rb_check_deadlock(rb_vm_t *vm); void rb_signal_exec(rb_thread_t *th, int sig); void rb_disable_interrupt(void); +void rb_thread_stop_timer_thread(void); static const VALUE eKillSignal = INT2FIX(0); static const VALUE eTerminateSignal = INT2FIX(1); @@ -318,7 +319,7 @@ rb_thread_terminate_all(void) } POP_TAG(); } - system_working = 0; + rb_thread_stop_timer_thread(); } static void @@ -2322,7 +2323,7 @@ int rb_get_next_signal(void); static void timer_thread_function(void *arg) { - rb_vm_t *vm = arg; /* TODO: fix me for Multi-VM */ + rb_vm_t *vm = GET_VM(); /* TODO: fix me for Multi-VM */ int sig; /* for time slice */ @@ -2355,8 +2356,7 @@ timer_thread_function(void *arg) void rb_thread_stop_timer_thread(void) { - if (timer_thread_id) { - system_working = 0; + if (timer_thread_id && native_stop_timer_thread()) { native_thread_join(timer_thread_id); timer_thread_id = 0; } -- cgit v1.2.3