aboutsummaryrefslogtreecommitdiffstats
path: root/thread.c
diff options
context:
space:
mode:
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c11
1 files changed, 10 insertions, 1 deletions
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) {