Simple library for keyed asynchronous reader-writer locks
![]() Bumps the actions group with 1 update: [codecov/codecov-action](https://github.com/codecov/codecov-action). Updates `codecov/codecov-action` from 4 to 5 - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/v4...v5) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> |
||
---|---|---|
.github | ||
src | ||
.gitignore | ||
Cargo.toml | ||
LICENSE | ||
README.md | ||
release.toml |
key-rwlock
Simple library for keyed asynchronous reader-writer locks.
Example
use key_rwlock::KeyRwLock;
#[tokio::main]
async fn main() {
let lock = KeyRwLock::new();
let _foo = lock.write("foo").await;
let _bar = lock.read("bar").await;
assert!(lock.try_read("foo").await.is_err());
assert!(lock.try_write("foo").await.is_err());
assert!(lock.try_read("bar").await.is_ok());
assert!(lock.try_write("bar").await.is_err());
}