summaryrefslogtreecommitdiff
path: root/thread_win32.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-12 13:20:55 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-12 13:20:55 +0000
commit4b022866eec600f3ed03ed57d5f7b05f09946b10 (patch)
treec02001ae9e0a10e203383dc7359e6d5c1306c07b /thread_win32.c
parent6f5aaff73b2b4e17666308dde93e1ac4edb3927d (diff)
* thread_win32.c (native_sleep): fixed previous commit.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17112 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread_win32.c')
-rw-r--r--thread_win32.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/thread_win32.c b/thread_win32.c
index 06e7892..2e05524 100644
--- a/thread_win32.c
+++ b/thread_win32.c
@@ -147,7 +147,7 @@ rb_w32_wait_events(HANDLE *events, int num, DWORD timeout)
int ret;
BLOCKING_REGION(ret = rb_w32_wait_events_blocking(events, num, timeout),
- ubf_handle, GET_THREAD());
+ ubf_handle, GET_THREAD(), 1);
return ret;
}
@@ -199,14 +199,16 @@ rb_w32_Sleep(unsigned long msec)
int ret;
BLOCKING_REGION(ret = rb_w32_sleep(msec),
- ubf_handle, GET_THREAD());
+ ubf_handle, GET_THREAD(), 1);
return ret;
}
static void
native_sleep(rb_thread_t *th, struct timeval *tv, int deadlockable)
{
+ int prev_status = th->status;
DWORD msec;
+
if (tv) {
msec = tv->tv_sec * 1000 + tv->tv_usec / 1000;
}
@@ -222,10 +224,10 @@ native_sleep(rb_thread_t *th, struct timeval *tv, int deadlockable)
else {
th->status = THREAD_STOPPED;
}
+
GVL_UNLOCK_BEGIN();
{
DWORD ret;
- int status = th->status;
th->unblock.func = ubf_handle;
th->unblock.arg = th;
@@ -243,7 +245,7 @@ native_sleep(rb_thread_t *th, struct timeval *tv, int deadlockable)
th->unblock.arg = 0;
}
GVL_UNLOCK_END();
- th->status = status;
+ th->status = prev_status;
if (!tv && deadlockable) th->vm->sleeper++;
RUBY_VM_CHECK_INTS();
}