pub struct SingleInstanceLock { /* private fields */ }Expand description
Mutex handle holding the single-instance lock and IPC listener thread.
Implementations§
Source§impl SingleInstanceLock
impl SingleInstanceLock
Sourcepub fn acquire<F>(
app_id: &str,
args: &[String],
on_secondary_args: F,
) -> Result<SingleInstanceStatus, Error>
pub fn acquire<F>( app_id: &str, args: &[String], on_secondary_args: F, ) -> Result<SingleInstanceStatus, Error>
Attempts to acquire an exclusive single-instance application lock for the given application ID.
If another instance is already running, forwards args to it and returns
SingleInstanceStatus::SecondaryExited.
If this is the first instance, binds the IPC channel and invokes on_secondary_args whenever
subsequent processes launch.
Sourcepub fn acquire_in_dir<F>(
app_id: &str,
args: &[String],
runtime_dir: &Path,
on_secondary_args: F,
) -> Result<SingleInstanceStatus, Error>
pub fn acquire_in_dir<F>( app_id: &str, args: &[String], runtime_dir: &Path, on_secondary_args: F, ) -> Result<SingleInstanceStatus, Error>
Acquires the lock inside an explicit runtime directory.
This is the testable form of SingleInstanceLock::acquire: callers can
point it at a private directory instead of mutating process environment
variables. On Windows the runtime directory is ignored because the named
pipe namespace is global.
Trait Implementations§
Source§impl Debug for SingleInstanceLock
impl Debug for SingleInstanceLock
Source§impl Drop for SingleInstanceLock
impl Drop for SingleInstanceLock
Auto Trait Implementations§
impl !RefUnwindSafe for SingleInstanceLock
impl !UnwindSafe for SingleInstanceLock
impl Forget for SingleInstanceLock
impl Freeze for SingleInstanceLock
impl Move for SingleInstanceLock
impl Send for SingleInstanceLock
impl Sync for SingleInstanceLock
impl Unpin for SingleInstanceLock
impl UnsafeUnpin for SingleInstanceLock
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