mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
2b66844f48
commit
6f5aaff73b
7 changed files with 294 additions and 40 deletions
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue