diff --git a/thread.c b/thread.c index 9324371..d99c2d6 100644 --- a/thread.c +++ b/thread.c @@ -834,8 +834,9 @@ static void 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++; @@ -846,7 +847,7 @@ sleep_forever(rb_thread_t *th, int deadlockable) th->vm->sleeper--; } RUBY_VM_CHECK_INTS(); - } while (th->status == THREAD_STOPPED_FOREVER); + } while (th->status == status); th->status = prev_status; } @@ -2953,13 +2954,10 @@ rb_threadptr_check_signal(rb_thread_t *mth) /* 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; } }