mirror of
https://github.com/serai-dex/serai.git
synced 2024-12-27 14:09:48 +00:00
880565cb81
Some checks failed
Coordinator Tests / build (push) Has been cancelled
crypto/ Tests / test-crypto (push) Has been cancelled
Full Stack Tests / build (push) Has been cancelled
Lint / clippy (macos-13) (push) Has been cancelled
Lint / clippy (macos-14) (push) Has been cancelled
Lint / clippy (ubuntu-latest) (push) Has been cancelled
Lint / clippy (windows-latest) (push) Has been cancelled
Lint / deny (push) Has been cancelled
Lint / fmt (push) Has been cancelled
Lint / machete (push) Has been cancelled
Message Queue Tests / build (push) Has been cancelled
Monero Tests / unit-tests (push) Has been cancelled
Reproducible Runtime / build (push) Has been cancelled
Tests / test-infra (push) Has been cancelled
common/ Tests / test-common (push) Has been cancelled
Monero Tests / integration-tests (v0.17.3.2) (push) Has been cancelled
Monero Tests / integration-tests (v0.18.2.0) (push) Has been cancelled
networks/ Tests / test-networks (push) Has been cancelled
no-std build / build (push) Has been cancelled
Processor Tests / build (push) Has been cancelled
Tests / test-substrate (push) Has been cancelled
Tests / test-serai-client (push) Has been cancelled
Preserves the fn accessors within the Monero crates so that we can use statics in some cfgs yet not all (in order to provide support for more low-memory devices) with the exception of `H` (which truly should be cached).
31 lines
707 B
Rust
31 lines
707 B
Rust
pub use core::sync::*;
|
|
pub use alloc::sync::*;
|
|
|
|
mod mutex_shim {
|
|
#[cfg(feature = "std")]
|
|
pub use std::sync::*;
|
|
#[cfg(not(feature = "std"))]
|
|
pub use spin::*;
|
|
|
|
#[derive(Default, Debug)]
|
|
pub struct ShimMutex<T>(Mutex<T>);
|
|
impl<T> ShimMutex<T> {
|
|
pub const fn new(value: T) -> Self {
|
|
Self(Mutex::new(value))
|
|
}
|
|
|
|
pub fn lock(&self) -> MutexGuard<'_, T> {
|
|
#[cfg(feature = "std")]
|
|
let res = self.0.lock().unwrap();
|
|
#[cfg(not(feature = "std"))]
|
|
let res = self.0.lock();
|
|
res
|
|
}
|
|
}
|
|
}
|
|
pub use mutex_shim::{ShimMutex as Mutex, MutexGuard};
|
|
|
|
#[cfg(feature = "std")]
|
|
pub use std::sync::LazyLock;
|
|
#[cfg(not(feature = "std"))]
|
|
pub use spin::Lazy as LazyLock;
|