Bug #7460 » terminate_all-deadlock-check.patch
| eval.c | ||
|---|---|---|
|
if ((state = EXEC_TAG()) == 0) {
|
||
|
SAVE_ROOT_JMPBUF(th, rb_thread_terminate_all());
|
||
|
}
|
||
|
else if (ex == 0) {
|
||
|
ex = state;
|
||
|
else {
|
||
|
if (state == TAG_FATAL) {
|
||
|
ex = state;
|
||
|
errs[1] = th->errinfo;
|
||
|
} else if (ex == 0) {
|
||
|
ex = state;
|
||
|
}
|
||
|
}
|
||
|
th->errinfo = errs[1];
|
||
|
ex = error_handle(ex);
|
||
| thread.c | ||
|---|---|---|
|
TH_PUSH_TAG(th);
|
||
|
if ((state = TH_EXEC_TAG()) == 0) {
|
||
|
GET_VM()->sleeper++;
|
||
|
native_sleep(th, 0);
|
||
|
GET_VM()->sleeper--;
|
||
|
RUBY_VM_CHECK_INTS_BLOCKING(th);
|
||
|
}
|
||
|
TH_POP_TAG();
|
||
|
if (state) {
|
||
|
if (state == TAG_FATAL) {
|
||
|
JUMP_TAG(state);
|
||
|
}
|
||
|
else if (state) {
|
||
|
goto retry;
|
||
|
}
|
||
|
}
|
||
| ... | ... | |
|
if (th->status == THREAD_STOPPED ||
|
||
|
th->status == THREAD_STOPPED_FOREVER)
|
||
|
th->status = THREAD_RUNNABLE;
|
||
|
rb_exc_raise(err);
|
||
|
if (rb_obj_is_kind_of(err, rb_eFatal))
|
||
|
rb_exc_fatal(err);
|
||
|
else
|
||
|
rb_exc_raise(err);
|
||
|
}
|
||
|
}
|
||
| ... | ... | |
|
rb_threadptr_raise(rb_thread_t *th, int argc, VALUE *argv)
|
||
|
{
|
||
|
VALUE exc;
|
||
|
int fatal = 0;
|
||
|
if (rb_threadptr_dead(th)) {
|
||
|
if (argc >= 1 && argv[0] == rb_eFatal)
|
||
|
fatal = 1;
|
||
|
if (!fatal && rb_threadptr_dead(th)) {
|
||
|
return Qnil;
|
||
|
}
|
||
| ... | ... | |
|
rb_thread_t *th;
|
||
|
GetThreadPtr(thval, th);
|
||
|
if (th->status != THREAD_STOPPED_FOREVER || RUBY_VM_INTERRUPTED(th)) {
|
||
|
if ((th->status & (THREAD_RUNNABLE|THREAD_STOPPED)) ||
|
||
|
RUBY_VM_INTERRUPTED(th)) {
|
||
|
*found = 1;
|
||
|
}
|
||
|
else if (th->locking_mutex) {
|
||
| vm_core.h | ||
|---|---|---|
|
TypedData_Get_Struct((obj), rb_thread_t, &ruby_threadptr_data_type, (ptr))
|
||
|
enum rb_thread_status {
|
||
|
THREAD_RUNNABLE,
|
||
|
THREAD_STOPPED,
|
||
|
THREAD_STOPPED_FOREVER,
|
||
|
THREAD_KILLED
|
||
|
THREAD_RUNNABLE = 0x1,
|
||
|
THREAD_STOPPED = 0x2,
|
||
|
THREAD_STOPPED_FOREVER = 0x4,
|
||
|
THREAD_KILLED = 0x8,
|
||
|
};
|
||
|
typedef RUBY_JMP_BUF rb_jmpbuf_t;
|
||