diff options
author | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-06-12 13:01:38 +0000 |
---|---|---|
committer | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-06-12 13:01:38 +0000 |
commit | 6f5aaff73b2b4e17666308dde93e1ac4edb3927d (patch) | |
tree | d2045cf78eb8d6b894357491b6686fa8d23b740f /thread_win32.c | |
parent | 2b66844f487574e2bcce1e3697883452d1f5d7fc (diff) |
* thread.c, vm_core.h, vm.c, thread_pthread.c, thread_win32.c: add
deadlock detection. [ruby-dev:35044]
* bootstraptest/test_thread.rb: add tests for above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17110 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread_win32.c')
-rw-r--r-- | thread_win32.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/thread_win32.c b/thread_win32.c index 63425511c1..06e7892036 100644 --- a/thread_win32.c +++ b/thread_win32.c @@ -204,7 +204,7 @@ rb_w32_Sleep(unsigned long msec) } static void -native_sleep(rb_thread_t *th, struct timeval *tv) +native_sleep(rb_thread_t *th, struct timeval *tv, int deadlockable) { DWORD msec; if (tv) { @@ -214,12 +214,19 @@ native_sleep(rb_thread_t *th, struct timeval *tv) msec = INFINITE; } + if (!tv && deadlockable) { + th->status = THREAD_STOPPED_FOREVER; + th->vm->sleeper++; + rb_check_deadlock(th->vm); + } + else { + th->status = THREAD_STOPPED; + } GVL_UNLOCK_BEGIN(); { DWORD ret; int status = th->status; - th->status = THREAD_STOPPED; th->unblock.func = ubf_handle; th->unblock.arg = th; @@ -234,9 +241,10 @@ native_sleep(rb_thread_t *th, struct timeval *tv) th->unblock.func = 0; th->unblock.arg = 0; - th->status = status; } GVL_UNLOCK_END(); + th->status = status; + if (!tv && deadlockable) th->vm->sleeper++; RUBY_VM_CHECK_INTS(); } |