1 pub(crate) use loom::*; 2 3 pub(crate) mod sync { 4 5 pub(crate) use loom::sync::MutexGuard; 6 7 #[derive(Debug)] 8 pub(crate) struct Mutex<T>(loom::sync::Mutex<T>); 9 10 #[allow(dead_code)] 11 impl<T> Mutex<T> { 12 #[inline] new(t: T) -> Mutex<T>13 pub(crate) fn new(t: T) -> Mutex<T> { 14 Mutex(loom::sync::Mutex::new(t)) 15 } 16 17 #[inline] lock(&self) -> MutexGuard<'_, T>18 pub(crate) fn lock(&self) -> MutexGuard<'_, T> { 19 self.0.lock().unwrap() 20 } 21 22 #[inline] try_lock(&self) -> Option<MutexGuard<'_, T>>23 pub(crate) fn try_lock(&self) -> Option<MutexGuard<'_, T>> { 24 self.0.try_lock().ok() 25 } 26 } 27 pub(crate) use loom::sync::*; 28 } 29 30 pub(crate) mod rand { seed() -> u6431 pub(crate) fn seed() -> u64 { 32 1 33 } 34 } 35 36 pub(crate) mod sys { num_cpus() -> usize37 pub(crate) fn num_cpus() -> usize { 38 2 39 } 40 } 41