File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -659,7 +659,9 @@ macro_rules! define_maps {
659
659
pub fn collect_active_jobs( & self ) -> Vec <Lrc <QueryJob <$tcx>>> {
660
660
let mut jobs = Vec :: new( ) ;
661
661
662
- $( for v in self . $name. lock( ) . active. values( ) {
662
+ // We use try_lock here since we are only called from the
663
+ // deadlock handler, and this shouldn't be locked
664
+ $( for v in self . $name. try_lock( ) . unwrap( ) . active. values( ) {
663
665
match * v {
664
666
QueryResult :: Started ( ref job) => jobs. push( job. clone( ) ) ,
665
667
_ => ( ) ,
Original file line number Diff line number Diff line change @@ -519,6 +519,18 @@ impl<T> Lock<T> {
519
519
self . 0 . get_mut ( )
520
520
}
521
521
522
+ #[ cfg( parallel_queries) ]
523
+ #[ inline( always) ]
524
+ pub fn try_lock ( & self ) -> Option < LockGuard < T > > {
525
+ self . 0 . try_lock ( )
526
+ }
527
+
528
+ #[ cfg( not( parallel_queries) ) ]
529
+ #[ inline( always) ]
530
+ pub fn try_lock ( & self ) -> Option < LockGuard < T > > {
531
+ self . 0 . try_borrow_mut ( ) . ok ( )
532
+ }
533
+
522
534
#[ cfg( parallel_queries) ]
523
535
#[ inline( always) ]
524
536
pub fn lock ( & self ) -> LockGuard < T > {
You can’t perform that action at this time.
0 commit comments