A simple SafeLock
struct.
std
forbid(unsafe_code)
Mutex<T>
. Does not contain a value.AtomicBool
in a spinlock, not fast OS locks.rusty-fork
std::sync::Mutex
core::lazy::OnceCell
or various unsafe
crates:
lazy_static
,
once_cell
,
lazycell
, and
conquer-once
.parking_lot
unsafe
try-lock
no_std
unsafe
ruspiro-lock
no_std
unsafe
flexible-locks
unsafe
safina-sync
provides a safe async Mutex
Make some tests run sequentially so they don't interfere with each other: ```rust use safe_lock::SafeLock; static LOCK: SafeLock = SafeLock::new();
[#test] fn test1() { let _guard = LOCK.lock(); // ... }
[#test] fn test2() { let _guard = LOCK.lock(); // ... } ```
```
Metric output format: x/y x = unsafe code used by the build y = total unsafe code found in the crate
Symbols:
🔒 = No unsafe
usage found, declares #![forbid(unsafecode)]
❓ = No unsafe
usage found, missing #![forbid(unsafecode)]
☢️ = unsafe
usage found
Functions Expressions Impls Traits Methods Dependency
0/0 0/0 0/0 0/0 0/0 🔒 safe-lock 0.1.2
0/0 0/0 0/0 0/0 0/0
```
Acquire
and Release
orderingFixing bugs and adding features is easy and fast. Send us a pull request and we intend to: - Always respond within 24 hours - Provide clear & concrete feedback - Immediately make a new release for your accepted change
License: Apache-2.0