pub struct NamedMutex { /* private fields */ }Expand description
A named exclusive mutex that can be used to ensure that only one instance of an application is running.
§Examples
use winctx::NamedMutex;
if let Some(_m) = NamedMutex::create_acquired("se.tedro.Example")? {
// The only one holding the mutex.
}Implementations§
Source§impl NamedMutex
impl NamedMutex
Sourcepub fn create_acquired<N>(name: N) -> Result<Option<Self>>where
N: Display,
pub fn create_acquired<N>(name: N) -> Result<Option<Self>>where
N: Display,
Create a named mutex with the given name that is already acquired.
Returns None if the mutex could not be acquired.
§Errors
Errors in case the named mutex could not be created.
§Examples
use winctx::NamedMutex;
if let Some(_m) = NamedMutex::create_acquired("se.tedro.Example")? {
// The only one holding the mutex.
}Auto Trait Implementations§
impl Freeze for NamedMutex
impl RefUnwindSafe for NamedMutex
impl Send for NamedMutex
impl Sync for NamedMutex
impl Unpin for NamedMutex
impl UnwindSafe for NamedMutex
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