pub struct GlobalLock<B: GlobalLockBackend> { /* private fields */ }
Expand description
Type used for global locks.
See global_lock!
for examples.
Implementations§
Source§impl<B: GlobalLockBackend> GlobalLock<B>
impl<B: GlobalLockBackend> GlobalLock<B>
Sourcepub const unsafe fn new(data: B::Item) -> Self
pub const unsafe fn new(data: B::Item) -> Self
Creates a global lock.
§Safety
- Before any other method on this lock is called,
Self::init
must be called. - The type
B
must not be used with any other lock.
Sourcepub fn lock(&'static self) -> GlobalGuard<B>
pub fn lock(&'static self) -> GlobalGuard<B>
Lock this global lock.
Sourcepub fn try_lock(&'static self) -> Option<GlobalGuard<B>>
pub fn try_lock(&'static self) -> Option<GlobalGuard<B>>
Try to lock this global lock.
Auto Trait Implementations§
impl<B> !Freeze for GlobalLock<B>
impl<B> !RefUnwindSafe for GlobalLock<B>
impl<B> Send for GlobalLock<B>
impl<B> Sync for GlobalLock<B>
impl<B> !Unpin for GlobalLock<B>
impl<B> UnwindSafe for GlobalLock<B>where
<B as GlobalLockBackend>::Item: UnwindSafe,
<<B as GlobalLockBackend>::Backend as Backend>::State: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more