pub struct Lock { /* private fields */ }Expand description
Cross-process exclusive bench lock. Drop releases.
Implementations§
Source§impl Lock
impl Lock
Sourcepub fn acquire(cfg: AcquireConfig) -> Result<Self>
pub fn acquire(cfg: AcquireConfig) -> Result<Self>
Block until the lock is acquired (subject to cfg.timeout).
Prints periodic “waiting on …” messages to stderr while blocked,
each describing the current holder and ETA.
Sourcepub fn try_acquire(
cfg: AcquireConfig,
) -> Result<Result<Self, Option<HolderInfo>>>
pub fn try_acquire( cfg: AcquireConfig, ) -> Result<Result<Self, Option<HolderInfo>>>
Try to acquire without blocking. On success, returns Ok(Lock).
If another process holds it, returns Ok(Err(Some(info))) with
the holder’s record. Ok(Err(None)) means the lock was held but
the holder file was unreadable.
Sourcepub fn peek(path: &Path) -> Result<Option<HolderInfo>>
pub fn peek(path: &Path) -> Result<Option<HolderInfo>>
Read the current holder’s record without taking the lock.
Returns Ok(None) if the file is absent, empty, or
mid-rewrite — the file format is self-validating with an
eof=1 sentinel.
Sourcepub fn default_path() -> PathBuf
pub fn default_path() -> PathBuf
Default lock path for the host. Use this if you want to construct a custom config that still rendezvouses on the system-wide path.
Sourcepub fn update_benchmark(&self, benchmark: &str)
pub fn update_benchmark(&self, benchmark: &str)
Update the benchmark= field in the holder file. Call this from
the engine as it transitions between bench groups.
Sourcepub fn update_eta(&self, eta: SystemTime)
pub fn update_eta(&self, eta: SystemTime)
Set a new ETA. Useful once the engine has measured a few groups and can extrapolate completion.
Sourcepub fn info(&self) -> Option<HolderInfo>
pub fn info(&self) -> Option<HolderInfo>
Snapshot of the current in-memory holder record.