summaryrefslogtreecommitdiffstats
path: root/tokio/tests/async_send_sync.rs
diff options
context:
space:
mode:
authorEliza Weisman <eliza@buoyant.io>2020-04-29 15:48:08 -0700
committerGitHub <noreply@github.com>2020-04-29 15:48:08 -0700
commit45773c56413267cbcf9d5e7877e8dc4afc1e5b07 (patch)
tree8d1353dac8323fbc6f85558b6250051f25e4d574 /tokio/tests/async_send_sync.rs
parentc52b78b7925f883289853dee5748b93a89e29bb1 (diff)
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 <eliza@buoyant.io>
Diffstat (limited to 'tokio/tests/async_send_sync.rs')
-rw-r--r--tokio/tests/async_send_sync.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/tokio/tests/async_send_sync.rs b/tokio/tests/async_send_sync.rs
index 1fea19c2..45d11bd4 100644
--- a/tokio/tests/async_send_sync.rs
+++ b/tokio/tests/async_send_sync.rs
@@ -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);