diff options
author | João Oliveira <hello@jxs.pt> | 2020-01-04 05:03:26 +0000 |
---|---|---|
committer | Carl Lerche <me@carllerche.com> | 2020-01-03 21:03:26 -0800 |
commit | 32e15b3a24ac177c92a78eb04e233534583eae17 (patch) | |
tree | d64a660fc2e497288880994f61c778c84e2e8edf /tokio/src/sync/mod.rs | |
parent | efcbf9613f2d5048550f9c828e3be422644f1391 (diff) |
sync: add RwLock (#1699)
Provides a `RwLock` based on a semaphore. The semaphore is initialized
with 32 permits. A read acquires a single permit and a write acquires all 32
permits. This ensures that reads (up to 32) may happen concurrently and
writes happen exclusively.
Diffstat (limited to 'tokio/src/sync/mod.rs')
-rw-r--r-- | tokio/src/sync/mod.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tokio/src/sync/mod.rs b/tokio/src/sync/mod.rs index 6ed91607..beb96920 100644 --- a/tokio/src/sync/mod.rs +++ b/tokio/src/sync/mod.rs @@ -32,6 +32,9 @@ cfg_sync! { mod semaphore; pub use semaphore::{Semaphore, SemaphorePermit}; + mod rwlock; + pub use rwlock::{RwLock, RwLockReadGuard, RwLockWriteGuard}; + mod task; pub(crate) use task::AtomicWaker; |