From 262c620e90c6f88430c10ef92ee07958085633d3 Mon Sep 17 00:00:00 2001 From: shyouhei Date: Tue, 14 Jul 2009 11:31:37 +0000 Subject: merge revision(s) 23202,23268,23305: * eval.c (safe_mutex_lock): pthread_cleanup_push() must not be inside parens. * eval.c (rb_thread_start_timer): guard condition was inverted. [ruby-dev:38319] * eval.c (get_ts): use readtime clock. [ruby-dev:38354] * eval.c (rb_thread_stop_timer): clear thread_init while locking. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@24104 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- eval.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'eval.c') diff --git a/eval.c b/eval.c index 8ae0d3f746..ab5a4f4a93 100644 --- a/eval.c +++ b/eval.c @@ -12252,8 +12252,8 @@ get_ts(struct timespec *to, long ns) { struct timeval tv; -#ifdef CLOCK_MONOTONIC - if (clock_gettime(CLOCK_MONOTONIC, to) != 0) +#ifdef CLOCK_REALTIME + if (clock_gettime(CLOCK_REALTIME, to) != 0) #endif { gettimeofday(&tv, NULL); @@ -12274,8 +12274,8 @@ static struct timer_thread { } time_thread = {PTHREAD_COND_INITIALIZER, PTHREAD_MUTEX_INITIALIZER}; #define safe_mutex_lock(lock) \ - (pthread_mutex_lock(lock), \ - pthread_cleanup_push((void (*)_((void *)))pthread_mutex_unlock, lock)) + pthread_mutex_lock(lock); \ + pthread_cleanup_push((void (*)_((void *)))pthread_mutex_unlock, lock) static void* thread_timer(dummy) @@ -12316,7 +12316,7 @@ rb_thread_start_timer() void *args[2]; static pthread_cond_t start = PTHREAD_COND_INITIALIZER; - if (!thread_init) return; + if (thread_init) return; args[0] = &time_thread; args[1] = &start; safe_mutex_lock(&time_thread.lock); @@ -12334,9 +12334,9 @@ rb_thread_stop_timer() if (!thread_init) return; safe_mutex_lock(&time_thread.lock); pthread_cond_signal(&time_thread.cond); + thread_init = 0; pthread_cleanup_pop(1); pthread_join(time_thread.thread, NULL); - thread_init = 0; } #elif defined(HAVE_SETITIMER) static void -- cgit v1.2.3