summaryrefslogtreecommitdiff
path: root/thread_sync.c
diff options
context:
space:
mode:
authorSamuel Williams <samuel.williams@oriontransfer.co.nz>2020-11-08 16:14:43 +1300
committerSamuel Williams <samuel.williams@oriontransfer.co.nz>2020-11-08 20:40:52 +1300
commitf73135233b1437eb2cc6a5c8c732adca1dbd41f2 (patch)
treedeee7e2584dee583c61433f8a8c715f73ce16cb5 /thread_sync.c
parentafe3cb782bbdb5ef38c865b1c857e6cd9083e978 (diff)
Don't try to resume blocked fiber on dead thread.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3743
Diffstat (limited to 'thread_sync.c')
-rw-r--r--thread_sync.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/thread_sync.c b/thread_sync.c
index 753b65e4dc..ef8cb5b853 100644
--- a/thread_sync.c
+++ b/thread_sync.c
@@ -29,15 +29,15 @@ sync_wakeup(struct list_head *head, long max)
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;
}
}