From 1a196574c4bd7867cd30f48d057680e5a1ab3364 Mon Sep 17 00:00:00 2001 From: nagachika Date: Sat, 25 Jun 2011 14:21:16 +0000 Subject: [PATCH] * thread.c (rb_threadptr_check_signal): remove unnecessary th->status backup. fix race condition which may results unexpected main thread's status transition. see #4072 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ thread.c | 5 +---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index cd5d22551e..7998c897ff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Sat Jun 25 23:14:47 2011 CHIKANAGA Tomoyuki + + * thread.c (rb_threadptr_check_signal): remove unnecessary th->status + backup. fix race condition which may results unexpected main thread's + status transition. see #4072 + Fri Jun 24 19:57:30 2011 Hiroshi Nakamura * lib/webrick/httprequest.rb (setup_forwarded_info): Parsing request diff --git a/thread.c b/thread.c index 9324371d16..e76b5ed99b 100644 --- a/thread.c +++ b/thread.c @@ -2953,13 +2953,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; } }