diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-07-09 13:41:19 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-07-09 13:41:19 +0000 |
commit | a14682906f063617ce22969dd100a512fe63ba33 (patch) | |
tree | b27897d65ee8f8da1987de36125d64842dfecc06 /thread_win32.c | |
parent | 6372357ad51ccbf909d36c6516229d3be0f30043 (diff) |
* thread.c (sleep_forever): wait until timed out. [ruby-core:17270]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17976 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread_win32.c')
-rw-r--r-- | thread_win32.c | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/thread_win32.c b/thread_win32.c index 54f7546130..a810fb3622 100644 --- a/thread_win32.c +++ b/thread_win32.c @@ -207,17 +207,9 @@ static void native_sleep(rb_thread_t *th, struct timeval *tv, int deadlockable) { int prev_status = th->status; - int retry = 0; - DWORD msec, ret; - struct timeval tvn, limit; + DWORD msec; if (tv) { - gettimeofday(&limit, NULL); - limit.tv_sec += tv->tv_sec; - if ((limit.tv_usec += tv->tv_usec) >= 1000000) { - limit.tv_sec += limit.tv_usec / 1000000; - limit.tv_usec %= 1000000; - } msec = tv->tv_sec * 1000 + tv->tv_usec / 1000; } else { @@ -233,9 +225,10 @@ native_sleep(rb_thread_t *th, struct timeval *tv, int deadlockable) th->status = THREAD_STOPPED; } - sleep_again: GVL_UNLOCK_BEGIN(); { + DWORD ret; + native_mutex_lock(&th->interrupt_lock); th->unblock.func = ubf_handle; th->unblock.arg = th; @@ -259,17 +252,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 (limit.tv_sec > tvn.tv_sec || - (limit.tv_sec == tvn.tv_sec && limit.tv_usec > tvn.tv_usec)) { - thread_debug("native_sleep: %ld.%.6ld > %ld.%.6ld\n", - (long)limit.tv_sec, limit.tv_usec, - (long)tvn.tv_sec, tvn.tv_usec); - retry = 1; - goto sleep_again; - } - } } static int |