Use try_lock in collect_active_jobs
This commit is contained in:
parent
d85b5eadea
commit
77259af56a
2 changed files with 15 additions and 1 deletions
|
|
@ -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> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue