From c04d79f8674aba919400e0469bfdd8cf5fc4c5df Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 17 Jul 2010 04:04:51 +0000 Subject: * thread.c (rb_thread_wakeup_alive): split from rb_thread_wakeup. merged from r13476. c.f. [ruby-core:31320] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28660 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- thread.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'thread.c') diff --git a/thread.c b/thread.c index be580ac98b..de60b4d226 100644 --- a/thread.c +++ b/thread.c @@ -1546,12 +1546,21 @@ 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) { -- cgit v1.2.3