diff options
author | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-07-14 11:31:37 +0000 |
---|---|---|
committer | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-07-14 11:31:37 +0000 |
commit | 262c620e90c6f88430c10ef92ee07958085633d3 (patch) | |
tree | 69c13e53ad7000f9d96de373a7777397de557b6b /eval.c | |
parent | 4fffacd9a51227cf043873d5ac3e961a2ed0a2f5 (diff) |
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
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -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 |