Skip to content

Commit 1152b9a

Browse files
author
Jacob Lacouture
committed
the actual fix
1 parent 92a1ce9 commit 1152b9a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

thread_pthread.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1276,8 +1276,8 @@ deferred_wait_thread_enqueue_yield(struct rb_thread_sched *sched, rb_thread_t *t
12761276
sched->deferred_wait_th = th;
12771277
sched->deferred_wait_seq1 += 1;
12781278

1279-
// Only link if we're not already linked.
1280-
if (!ccan_node_linked(&sched->deferred_wait_link)) {
1279+
// Only link if we're not already linked and the background thread is running.
1280+
if (!ccan_node_linked(&sched->deferred_wait_link) && thread_deferred_wait.running) {
12811281
rb_native_mutex_lock(&thread_deferred_wait.lock);
12821282
// We held the sched lock while waiting for the mutex so we should not have been unlinked.
12831283
VM_ASSERT(!ccan_node_linked(&sched->deferred_wait_link));

0 commit comments

Comments
 (0)