aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--include/ruby/intern.h1
-rw-r--r--thread.c11
3 files changed, 16 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 8e9158a3e5..f634a9ed9a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sat Jul 17 13:04:45 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * thread.c (rb_thread_wakeup_alive): split from rb_thread_wakeup.
+ merged from r13476. c.f. [ruby-core:31320]
+
Sat Jul 17 10:07:52 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/test/unit.rb: MiniTest::Unit is different class from
diff --git a/include/ruby/intern.h b/include/ruby/intern.h
index f47942b69a..98a194d2a6 100644
--- a/include/ruby/intern.h
+++ b/include/ruby/intern.h
@@ -333,6 +333,7 @@ void rb_thread_sleep(int);
void rb_thread_sleep_forever(void);
VALUE rb_thread_stop(void);
VALUE rb_thread_wakeup(VALUE);
+VALUE rb_thread_wakeup_alive(VALUE);
VALUE rb_thread_run(VALUE);
VALUE rb_thread_kill(VALUE);
VALUE rb_thread_create(VALUE (*)(ANYARGS), void*);
diff --git a/thread.c b/thread.c
index be580ac98b..de60b4d226 100644
--- a/thread.c
+++ b/thread.c
@@ -1547,11 +1547,20 @@ rb_thread_exit(void)
VALUE
rb_thread_wakeup(VALUE thread)
{
+ if (!RTEST(rb_thread_wakeup_alive(thread))) {
+ rb_raise(rb_eThreadError, "killed thread");
+ }
+ return thread;
+}
+
+VALUE
+rb_thread_wakeup_alive(VALUE thread)
+{
rb_thread_t *th;
GetThreadPtr(thread, th);
if (th->status == THREAD_KILLED) {
- rb_raise(rb_eThreadError, "killed thread");
+ return Qnil;
}
rb_threadptr_ready(th);
if (th->status != THREAD_TO_KILL) {