simple-mutex

Build License Cargo Documentation

A simple mutex.

This mutex is more efficient than std::sync::Mutex and smaller than parking_lot::Mutex.

Examples

```rust use simple_mutex::Mutex; use std::sync::Arc; use std::thread;

let m = Arc::new(Mutex::new(0)); let mut threads = vec![];

for _ in 0..10 { let m = m.clone(); threads.push(thread::spawn(move || { *m.lock() += 1; })); }

for t in threads { t.join().unwrap(); } assert_eq!(*m.lock(), 10); ```

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.