Use Mutex
to avoid issue with conditional locks
This commit is contained in:
parent
242805442b
commit
d36393b839
@ -41,6 +41,7 @@
|
||||
//! [^2] `MTLockRef` is a typedef.
|
||||
|
||||
pub use crate::marker::*;
|
||||
use parking_lot::Mutex;
|
||||
use std::any::Any;
|
||||
use std::collections::HashMap;
|
||||
use std::hash::{BuildHasher, Hash};
|
||||
@ -110,13 +111,13 @@ pub fn set_dyn_thread_safe_mode(mode: bool) {
|
||||
/// continuing with unwinding. It's also used for the non-parallel code to ensure error message
|
||||
/// output match the parallel compiler for testing purposes.
|
||||
pub struct ParallelGuard {
|
||||
panic: Lock<Option<Box<dyn Any + std::marker::Send + 'static>>>,
|
||||
panic: Mutex<Option<Box<dyn Any + std::marker::Send + 'static>>>,
|
||||
}
|
||||
|
||||
impl ParallelGuard {
|
||||
#[inline]
|
||||
pub fn new() -> Self {
|
||||
ParallelGuard { panic: Lock::new(None) }
|
||||
ParallelGuard { panic: Mutex::new(None) }
|
||||
}
|
||||
|
||||
pub fn run<R>(&self, f: impl FnOnce() -> R) -> Option<R> {
|
||||
@ -316,8 +317,6 @@ fn clone(&self) -> Self {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
use parking_lot::Mutex;
|
||||
|
||||
pub use std::marker::Send as Send;
|
||||
pub use std::marker::Sync as Sync;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user