diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-12-25 04:16:06 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-12-25 04:16:06 +0000 |
commit | 5f0b8afb97d7830de8f04a7d6a39cde660020c69 (patch) | |
tree | 586fd664680dab1af107c4867000d4280ff054e7 /thread_win32.c | |
parent | 94c942ed34e328f23c3d3316b4bf66ecfda8bf8a (diff) | |
download | ruby-5f0b8afb97d7830de8f04a7d6a39cde660020c69.tar.gz |
* vm_core.h, thread.c, cont.c: add RUBY_VM_SET_INTERRUPT(),
RUBY_VM_SET_TIMER_INTERRUPT(), RUBY_VM_INTERRUPTED().
* thread.c, thread_pthread.c, thread_win32.c: fix to ignore time slice
event until sleep.
* bootstraptest/test_thread.rb: add a test for time limited join test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread_win32.c')
-rw-r--r-- | thread_win32.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/thread_win32.c b/thread_win32.c index d8b33e23e0..a7326ebfc5 100644 --- a/thread_win32.c +++ b/thread_win32.c @@ -208,17 +208,26 @@ native_sleep(rb_thread_t *th, struct timeval *tv) { DWORD ret; int status = th->status; + th->status = THREAD_STOPPED; th->unblock_function = ubf_handle; th->unblock_function_arg = th; - thread_debug("native_sleep start (%d)\n", (int)msec); - ret = w32_wait_events(0, 0, msec, th); - thread_debug("native_sleep done (%d)\n", ret); + + if (RUBY_VM_INTERRUPTED(th)) { + /* interrupted. return immediate */ + } + else { + thread_debug("native_sleep start (%d)\n", (int)msec); + ret = w32_wait_events(0, 0, msec, th); + thread_debug("native_sleep done (%d)\n", ret); + } + th->unblock_function = 0; th->unblock_function_arg = 0; th->status = status; } GVL_UNLOCK_END(); + RUBY_VM_CHECK_INTS(); } int |