Skip to content

Commit c54b1bb

Browse files
committed
wip
1 parent 2585741 commit c54b1bb

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/librustc/ty/maps/job.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,13 @@ struct QueryWaiter<'a, 'tcx: 'a> {
167167

168168
#[cfg(parallel_queries)]
169169
impl<'a, 'tcx> QueryWaiter<'a, 'tcx> {
170-
fn notify(&self, tcx: TyCtxt<'_, '_, '_>) {
170+
fn notify(&self, tcx: TyCtxt<'_, '_, '_>, registry: &rayon_core::Registry) {
171171
tcx.active_threads.fetch_add(1, Ordering::SeqCst);
172172
eprintln!("[{:?}] (wake) active threads: {} condvar: {:x}",
173173
::std::thread::current().id(),
174174
tcx.active_threads.load(Ordering::SeqCst),
175175
&self.condvar as *const _ as usize);
176-
rayon_core::unblock();
176+
rayon_core::unblock(registry);
177177
self.condvar.notify_one();
178178
}
179179
}
@@ -228,8 +228,9 @@ impl QueryLatch {
228228
let mut info = self.info.lock();
229229
debug_assert!(!info.complete);
230230
info.complete = true;
231+
let registry = rayon_core::Registry::current();
231232
for waiter in info.waiters.drain(..) {
232-
waiter.notify(tcx);
233+
waiter.notify(tcx, &registry);
233234
}
234235
}
235236

@@ -451,6 +452,8 @@ pub fn handle_deadlock() {
451452
use syntax;
452453
use syntax_pos;
453454

455+
let registry = rayon_core::Registry::current();
456+
454457
let gcx_ptr = tls::GCX_PTR.with(|gcx_ptr| {
455458
gcx_ptr as *const _
456459
});
@@ -471,7 +474,7 @@ pub fn handle_deadlock() {
471474
syntax_pos::GLOBALS.set(syntax_pos_globals, || {
472475
tls::with_thread_locals(|| {
473476
unsafe {
474-
tls::with_global(|tcx| deadlock(tcx))
477+
tls::with_global(|tcx| deadlock(tcx, &registry))
475478
}
476479
})
477480
})
@@ -481,7 +484,7 @@ pub fn handle_deadlock() {
481484
}
482485

483486
#[cfg(parallel_queries)]
484-
fn deadlock(tcx: TyCtxt<'_, '_, '_>) {
487+
fn deadlock(tcx: TyCtxt<'_, '_, '_>, registry: &rayon_core::Registry) {
485488
let on_panic = OnDrop(|| {
486489
eprintln!("deadlock handler panicked, aborting process");
487490
process::abort();
@@ -514,7 +517,7 @@ fn deadlock(tcx: TyCtxt<'_, '_, '_>) {
514517

515518
// FIXME: Ensure this won't cause a deadlock before we return
516519
for waiter in wakelist.into_iter() {
517-
waiter.notify(tcx);
520+
waiter.notify(tcx, registry);
518521
}
519522

520523
//eprintln!("aborting due to deadlock");

0 commit comments

Comments
 (0)