1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
usa 2008-06-12 13:20:55 +00:00
parent 6f5aaff73b
commit 4b022866ee
2 changed files with 10 additions and 4 deletions

View file

@ -1,3 +1,7 @@
Thu Jun 12 22:19:45 2008 NAKAMURA Usaku <usa@ruby-lang.org>
* thread_win32.c (native_sleep): fixed previous commit.
Thu Jun 12 21:59:17 2008 Yusuke Endoh <mame@tsg.ne.jp> Thu Jun 12 21:59:17 2008 Yusuke Endoh <mame@tsg.ne.jp>
* thread.c, vm_core.h, vm.c, thread_pthread.c, thread_win32.c: add * thread.c, vm_core.h, vm.c, thread_pthread.c, thread_win32.c: add

View file

@ -147,7 +147,7 @@ rb_w32_wait_events(HANDLE *events, int num, DWORD timeout)
int ret; int ret;
BLOCKING_REGION(ret = rb_w32_wait_events_blocking(events, num, timeout), BLOCKING_REGION(ret = rb_w32_wait_events_blocking(events, num, timeout),
ubf_handle, GET_THREAD()); ubf_handle, GET_THREAD(), 1);
return ret; return ret;
} }
@ -199,14 +199,16 @@ rb_w32_Sleep(unsigned long msec)
int ret; int ret;
BLOCKING_REGION(ret = rb_w32_sleep(msec), BLOCKING_REGION(ret = rb_w32_sleep(msec),
ubf_handle, GET_THREAD()); ubf_handle, GET_THREAD(), 1);
return ret; return ret;
} }
static void static void
native_sleep(rb_thread_t *th, struct timeval *tv, int deadlockable) native_sleep(rb_thread_t *th, struct timeval *tv, int deadlockable)
{ {
int prev_status = th->status;
DWORD msec; DWORD msec;
if (tv) { if (tv) {
msec = tv->tv_sec * 1000 + tv->tv_usec / 1000; 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 { else {
th->status = THREAD_STOPPED; th->status = THREAD_STOPPED;
} }
GVL_UNLOCK_BEGIN(); GVL_UNLOCK_BEGIN();
{ {
DWORD ret; DWORD ret;
int status = th->status;
th->unblock.func = ubf_handle; th->unblock.func = ubf_handle;
th->unblock.arg = th; th->unblock.arg = th;
@ -243,7 +245,7 @@ native_sleep(rb_thread_t *th, struct timeval *tv, int deadlockable)
th->unblock.arg = 0; th->unblock.arg = 0;
} }
GVL_UNLOCK_END(); GVL_UNLOCK_END();
th->status = status; th->status = prev_status;
if (!tv && deadlockable) th->vm->sleeper++; if (!tv && deadlockable) th->vm->sleeper++;
RUBY_VM_CHECK_INTS(); RUBY_VM_CHECK_INTS();
} }