Update Android.bp by running cargo_embargo am: 78e8e5d81c Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/named-lock/+/3209092 Change-Id: I3667af0ae8920e24631e43ab43bd874ac5f6035c Signed-off-by: Automerger Merge Worker <[email protected]>
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.