Skip to content

Commit 14786ce

Browse files
committed
Batch mark waiters as unblocked when resuming in the deadlock handler
1 parent fbcf765 commit 14786ce

File tree

1 file changed

+8
-2
lines changed
  • compiler/rustc_query_system/src/query

1 file changed

+8
-2
lines changed

compiler/rustc_query_system/src/query/job.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -506,9 +506,15 @@ pub fn break_query_cycles(query_map: QueryMap, registry: &rayon_core::Registry)
506506
);
507507
}
508508

509-
// FIXME: Ensure this won't cause a deadlock before we return
509+
// Mark all the thread we're about to wake up as unblocked. This needs to be done before
510+
// we wake the threads up as otherwise Rayon could detect a deadlock if a thread we
511+
// resumed fell asleep and this thread had yet to mark the remaining threads as unblocked.
512+
for _ in 0..wakelist.len() {
513+
rayon_core::mark_unblocked(registry);
514+
}
515+
510516
for waiter in wakelist.into_iter() {
511-
waiter.notify(registry);
517+
waiter.condvar.notify_one();
512518
}
513519
}
514520

0 commit comments

Comments
 (0)