ruby-changes:63545
From: Samuel <ko1@a...>
Date: Sun, 8 Nov 2020 16:41:13 +0900 (JST)
Subject: [ruby-changes:63545] f73135233b (master): Don't try to resume blocked fiber on dead thread.
https://git.ruby-lang.org/ruby.git/commit/?id=f73135233b From f73135233b1437eb2cc6a5c8c732adca1dbd41f2 Mon Sep 17 00:00:00 2001 From: Samuel Williams <samuel.williams@o...> Date: Sun, 8 Nov 2020 16:14:43 +1300 Subject: Don't try to resume blocked fiber on dead thread. diff --git a/thread_sync.c b/thread_sync.c index 753b65e..ef8cb5b 100644 --- a/thread_sync.c +++ b/thread_sync.c @@ -29,15 +29,15 @@ sync_wakeup(struct list_head *head, long max) https://github.com/ruby/ruby/blob/trunk/thread_sync.c#L29 list_for_each_safe(head, cur, next, node) { list_del_init(&cur->node); - if (cur->th->scheduler != Qnil) { - rb_scheduler_unblock(cur->th->scheduler, cur->self, rb_fiberptr_self(cur->fiber)); - } - if (cur->th->status != THREAD_KILLED) { - if (cur->th->scheduler == Qnil) { + + if (cur->th->scheduler != Qnil) { + rb_scheduler_unblock(cur->th->scheduler, cur->self, rb_fiberptr_self(cur->fiber)); + } else { rb_threadptr_interrupt(cur->th); cur->th->status = THREAD_RUNNABLE; } + if (--max == 0) return; } } -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/