Struct sgx_sync::StaticMutex
source · [−]pub struct StaticMutex(_);
Expand description
An SGX-based mutual exclusion lock, meant for use in static variables.
This mutex has a const constructor (StaticMutex::new
), does not
implement Drop
to cleanup resources, and causes UB when used reentrantly.
This mutex does not implement poisoning.
This is a wrapper around imp::Mutex
that does not call init()
and
destroy()
.
Implementations
sourceimpl StaticMutex
impl StaticMutex
sourcepub const fn new() -> StaticMutex
pub const fn new() -> StaticMutex
Creates a new mutex for use.
sourcepub unsafe fn lock(&'static self) -> StaticMutexGuard
pub unsafe fn lock(&'static self) -> StaticMutexGuard
Calls raw_lock() and then returns an RAII guard to guarantee the mutex will be unlocked.
It is undefined behaviour to call this function while locked by the same thread.
Trait Implementations
impl Sync for StaticMutex
Auto Trait Implementations
impl RefUnwindSafe for StaticMutex
impl Send for StaticMutex
impl Unpin for StaticMutex
impl UnwindSafe for StaticMutex
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more