diff options
| author | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2025-03-24 02:09:14 +0100 |
|---|---|---|
| committer | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2025-03-24 02:09:14 +0100 |
| commit | 14786ce645ef96c732f8b30154bc939ee4ba9faf (patch) | |
| tree | 4ce4c70ada611fbb60d9d7f49181658cb8c5dd97 /compiler/rustc_query_system/src | |
| parent | fbcf7657055a5a562fa7cc176e4bafec9e99c661 (diff) | |
| download | rust-14786ce645ef96c732f8b30154bc939ee4ba9faf.tar.gz rust-14786ce645ef96c732f8b30154bc939ee4ba9faf.zip | |
Batch mark waiters as unblocked when resuming in the deadlock handler
Diffstat (limited to 'compiler/rustc_query_system/src')
| -rw-r--r-- | compiler/rustc_query_system/src/query/job.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler/rustc_query_system/src/query/job.rs b/compiler/rustc_query_system/src/query/job.rs index a8c2aa98cd0..e6ab7c4ef57 100644 --- a/compiler/rustc_query_system/src/query/job.rs +++ b/compiler/rustc_query_system/src/query/job.rs @@ -506,9 +506,15 @@ pub fn break_query_cycles(query_map: QueryMap, registry: &rayon_core::Registry) ); } - // FIXME: Ensure this won't cause a deadlock before we return + // Mark all the thread we're about to wake up as unblocked. This needs to be done before + // we wake the threads up as otherwise Rayon could detect a deadlock if a thread we + // resumed fell asleep and this thread had yet to mark the remaining threads as unblocked. + for _ in 0..wakelist.len() { + rayon_core::mark_unblocked(registry); + } + for waiter in wakelist.into_iter() { - waiter.notify(registry); + waiter.condvar.notify_one(); } } |
