commit | b32bd00e6b1c717bb3e9bc53ca32c6a5423d39f3 | [log] [tgz] |
---|---|---|
author | James Farrell <[email protected]> | Tue May 21 18:52:17 2024 +0000 |
committer | James Farrell <[email protected]> | Tue May 21 18:52:17 2024 +0000 |
tree | 57d115b505e55dc06848c14d020d46b6c3b00c3c | |
parent | 1ea30e22e3484e44050a4dbf36ee64f89f640f08 [diff] |
Update Android.bp by running cargo_embargo Test: ran cargo_embargo Change-Id: Icfb2d4a0cab9267dfd2d5adfbeab4e1e12265a54
This crate provides a simple and cross-platform implementation of named locks. You can use this to lock sections between processes.
use named_lock::NamedLock; use named_lock::Result; fn main() -> Result<()> { let lock = NamedLock::create("foobar")?; let _guard = lock.lock()?; // Do something... Ok(()) }
On UNIX this is implemented by using files and flock
. The path of the created lock file will be $TMPDIR/<name>.lock
, or /tmp/<name>.lock
if TMPDIR
environment variable is not set.
On Windows this is implemented by creating named mutex with CreateMutexW
.