summaryrefslogtreecommitdiffstats
path: root/thread_pthread.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-07-09 13:41:19 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-07-09 13:41:19 +0000
commit407576df0db055c8f9c1d0f39df41b3117b6e18d (patch)
treeb27897d65ee8f8da1987de36125d64842dfecc06 /thread_pthread.c
parent6219a5db8795d54c01a077b288974ec00f03723b (diff)
downloadruby-407576df0db055c8f9c1d0f39df41b3117b6e18d.tar.gz
ruby-407576df0db055c8f9c1d0f39df41b3117b6e18d.tar.xz
ruby-407576df0db055c8f9c1d0f39df41b3117b6e18d.zip
* thread.c (sleep_forever): wait until timed out. [ruby-core:17270]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17976 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread_pthread.c')
-rw-r--r--thread_pthread.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/thread_pthread.c b/thread_pthread.c
index c6aca1d46..4787823b3 100644
--- a/thread_pthread.c
+++ b/thread_pthread.c
@@ -496,7 +496,6 @@ static void
native_sleep(rb_thread_t *th, struct timeval *tv, int deadlockable)
{
int prev_status = th->status;
- int retry = 0;
struct timespec ts;
struct timeval tvn;
@@ -520,7 +519,6 @@ native_sleep(rb_thread_t *th, struct timeval *tv, int deadlockable)
}
thread_debug("native_sleep %ld\n", tv ? tv->tv_sec : -1);
- sleep_again:
GVL_UNLOCK_BEGIN();
{
pthread_mutex_lock(&th->interrupt_lock);
@@ -532,7 +530,7 @@ native_sleep(rb_thread_t *th, struct timeval *tv, int deadlockable)
thread_debug("native_sleep: interrupted before sleep\n");
}
else {
- if (tv == 0 || (!retry && ts.tv_sec < tvn.tv_sec /* overflow */)) {
+ if (tv == 0 || ts.tv_sec < tvn.tv_sec /* overflow */ ) {
int r;
thread_debug("native_sleep: pthread_cond_wait start\n");
r = pthread_cond_wait(&th->native_thread_data.sleep_cond,
@@ -542,7 +540,7 @@ native_sleep(rb_thread_t *th, struct timeval *tv, int deadlockable)
}
else {
int r;
- thread_debug("native_sleep: pthread_cond_timedwait start (%ld.%.9ld)\n",
+ thread_debug("native_sleep: pthread_cond_timedwait start (%ld, %ld)\n",
(unsigned long)ts.tv_sec, ts.tv_nsec);
r = pthread_cond_timedwait(&th->native_thread_data.sleep_cond,
&th->interrupt_lock, &ts);
@@ -560,17 +558,6 @@ native_sleep(rb_thread_t *th, struct timeval *tv, int deadlockable)
th->status = prev_status;
if (!tv && deadlockable) th->vm->sleeper--;
RUBY_VM_CHECK_INTS();
- if (tv) {
- gettimeofday(&tvn, NULL);
- if (ts.tv_sec > tvn.tv_sec ||
- (ts.tv_sec == tvn.tv_sec && ts.tv_nsec > tvn.tv_usec * 1000)) {
- thread_debug("native_sleep: %ld.%.9ld > %ld.%.6ld\n",
- (long)ts.tv_sec, ts.tv_nsec,
- (long)tvn.tv_sec, tvn.tv_usec);
- retry = 1;
- goto sleep_again;
- }
- }
thread_debug("native_sleep done\n");
}