summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-11-30 09:22:31 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-11-30 09:22:31 +0000
commit2015069a204e8ba13709f94aed5e4341ea297728 (patch)
treee2671d3edc017889d4821db6c8d1a69c3e181abf /thread.c
parentd22b7e6ddbd5c616d90c82cb86fd5797cd2d5a61 (diff)
downloadruby-2015069a204e8ba13709f94aed5e4341ea297728.tar.gz
* 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
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c8
1 files changed, 4 insertions, 4 deletions
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;
}