mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-02 00:00:11 +02:00
mutex: add OwnedMutexGuard for Arc<Mutex<T>>s (#2455)
This PR adds a new `OwnedMutexGuard` type and `lock_owned` and `try_lock_owned` methods for `Arc<Mutex<T>>`. This is pretty much the same as the similar APIs added in #2421. I've also corrected some existing documentation that incorrectly implied that the existing `lock` method cloned an internal `Arc` — I think this may be a holdover from `tokio` 0.1's `Lock` type? Signed-off-by: Eliza Weisman <[email protected]>
This commit is contained in:
@@ -203,6 +203,9 @@ async_assert_fn!(tokio::sync::Barrier::wait(_): Send & Sync);
|
||||
async_assert_fn!(tokio::sync::Mutex<u8>::lock(_): Send & Sync);
|
||||
async_assert_fn!(tokio::sync::Mutex<Cell<u8>>::lock(_): Send & Sync);
|
||||
async_assert_fn!(tokio::sync::Mutex<Rc<u8>>::lock(_): !Send & !Sync);
|
||||
async_assert_fn!(tokio::sync::Mutex<u8>::lock_owned(_): Send & Sync);
|
||||
async_assert_fn!(tokio::sync::Mutex<Cell<u8>>::lock_owned(_): Send & Sync);
|
||||
async_assert_fn!(tokio::sync::Mutex<Rc<u8>>::lock_owned(_): !Send & !Sync);
|
||||
async_assert_fn!(tokio::sync::Notify::notified(_): Send & !Sync);
|
||||
async_assert_fn!(tokio::sync::RwLock<u8>::read(_): Send & Sync);
|
||||
async_assert_fn!(tokio::sync::RwLock<u8>::write(_): Send & Sync);
|
||||
|
||||
Reference in New Issue
Block a user