Use try_lock in collect_active_jobs

This commit is contained in:
John Kåre Alsaker 2018-05-27 07:46:19 +02:00
parent d85b5eadea
commit 77259af56a
2 changed files with 15 additions and 1 deletions

View file

@ -519,6 +519,18 @@ impl<T> Lock<T> {
self.0.get_mut()
}
#[cfg(parallel_queries)]
#[inline(always)]
pub fn try_lock(&self) -> Option<LockGuard<T>> {
self.0.try_lock()
}
#[cfg(not(parallel_queries))]
#[inline(always)]
pub fn try_lock(&self) -> Option<LockGuard<T>> {
self.0.try_borrow_mut().ok()
}
#[cfg(parallel_queries)]
#[inline(always)]
pub fn lock(&self) -> LockGuard<T> {