Skip to content

Commit

Permalink
Fix a race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoxc committed Dec 6, 2018
1 parent ecd5efa commit 4fac739
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/librustc/ty/query/job.rs
Expand Up @@ -103,8 +103,11 @@ impl<'tcx> QueryJob<'tcx> {
condvar: Condvar::new(),
});
self.latch.await(&waiter);

match Lrc::get_mut(&mut waiter).unwrap().cycle.get_mut().take() {
// FIXME: Get rid of this lock. We have ownership of the QueryWaiter
// although another thread may still have a Lrc reference so we cannot
// use Lrc::get_mut
let mut cycle = waiter.cycle.lock();
match cycle.take() {
None => Ok(()),
Some(cycle) => Err(cycle)
}
Expand Down

0 comments on commit 4fac739

Please sign in to comment.