async-rwlock
An async reader-writer lock.
The locking stragegy is fair: neither readers nor writers will be starved, assuming the task executor is also fair.
Examples
use RwLock;
let lock = new;
// Multiple read locks can be held at a time.
let r1 = lock.read.await;
let r2 = lock.read.await;
assert_eq!;
assert_eq!;
drop;
// Only one write lock can be held at a time.
let mut w = lock.write.await;
*w += 1;
assert_eq!;
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
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.