Project

General

Profile

Bug #4072 » sleep_forever.patch

nagachika (Tomoyuki Chikanaga), 06/24/2011 11:10 PM

View differences:

thread.c
sleep_forever(rb_thread_t *th, int deadlockable)
{
enum rb_thread_status prev_status = th->status;
enum rb_thread_status status = deadlockable ? THREAD_STOPPED_FOREVER : THREAD_STOPPED;
th->status = deadlockable ? THREAD_STOPPED_FOREVER : THREAD_STOPPED;
th->status = status;
do {
if (deadlockable) {
th->vm->sleeper++;
......
th->vm->sleeper--;
}
RUBY_VM_CHECK_INTS();
} while (th->status == THREAD_STOPPED_FOREVER);
} while (th->status == status);
th->status = prev_status;
}
......
/* mth must be main_thread */
if (!mth->exec_signal && (sig = rb_get_next_signal()) > 0) {
enum rb_thread_status prev_status = mth->status;
thread_debug("main_thread: %s, sig: %d\n",
thread_status_name(prev_status), sig);
thread_status_name(mth->status), sig);
mth->exec_signal = sig;
if (mth->status != THREAD_KILLED) mth->status = THREAD_RUNNABLE;
rb_threadptr_interrupt(mth);
mth->status = prev_status;
}
}
    (1-1/1)