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 {
659659 pub fn collect_active_jobs( & self ) -> Vec <Lrc <QueryJob <$tcx>>> {
660660 let mut jobs = Vec :: new( ) ;
661661
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( ) {
663665 match * v {
664666 QueryResult :: Started ( ref job) => jobs. push( job. clone( ) ) ,
665667 _ => ( ) ,
Original file line number Diff line number Diff line change @@ -519,6 +519,18 @@ impl<T> Lock<T> {
519519 self . 0 . get_mut ( )
520520 }
521521
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+
522534 #[ cfg( parallel_queries) ]
523535 #[ inline( always) ]
524536 pub fn lock ( & self ) -> LockGuard < T > {
You can’t perform that action at this time.
0 commit comments