diff --git a/mea/src/lib.rs b/mea/src/lib.rs index 8c6e3ab..36d1e17 100644 --- a/mea/src/lib.rs +++ b/mea/src/lib.rs @@ -84,18 +84,32 @@ mod tests { use crate::waitgroup::WaitGroup; #[test] - fn send_and_sync() { - fn assert_send_and_sync() {} - assert_send_and_sync::(); - assert_send_and_sync::(); - assert_send_and_sync::(); - assert_send_and_sync::(); - assert_send_and_sync::(); + fn assert_send_and_sync() { + fn do_assert_send_and_sync() {} + do_assert_send_and_sync::(); + do_assert_send_and_sync::(); + do_assert_send_and_sync::(); + do_assert_send_and_sync::(); + do_assert_send_and_sync::(); + do_assert_send_and_sync::>(); + do_assert_send_and_sync::>(); + do_assert_send_and_sync::>(); + do_assert_send_and_sync::>(); + do_assert_send_and_sync::>(); + } - assert_send_and_sync::>(); - assert_send_and_sync::>(); - assert_send_and_sync::>(); - assert_send_and_sync::>(); - assert_send_and_sync::>(); + #[test] + fn assert_unpin() { + fn do_assert_unpin() {} + do_assert_unpin::(); + do_assert_unpin::(); + do_assert_unpin::(); + do_assert_unpin::(); + do_assert_unpin::(); + do_assert_unpin::>(); + do_assert_unpin::>(); + do_assert_unpin::>(); + do_assert_unpin::>(); + do_assert_unpin::>(); } } diff --git a/mea/src/mutex/mod.rs b/mea/src/mutex/mod.rs index 0ca81af..07e2f7e 100644 --- a/mea/src/mutex/mod.rs +++ b/mea/src/mutex/mod.rs @@ -106,13 +106,17 @@ impl Mutex { } impl Mutex { - /// Locks this mutex, causing the current task to yield until the lock has - /// been acquired. When the lock has been acquired, function returns a - /// [`MutexGuard`]. + /// Locks this mutex, causing the current task to yield until the lock has been acquired. When + /// the lock has been acquired, function returns a [`MutexGuard`]. /// - /// This method is async and will yield the current task if the mutex is - /// currently held by another task. When the mutex becomes available, the - /// task will be woken up and given the lock. + /// This method is async and will yield the current task if the mutex is currently held by + /// another task. When the mutex becomes available, the task will be woken up and given the + /// lock. + /// + /// # Cancel safety + /// + /// This method uses a queue to fairly distribute locks in the order they were requested. + /// Cancelling a call to `lock` makes you lose your place in the queue. /// /// # Examples /// diff --git a/mea/src/semaphore/mod.rs b/mea/src/semaphore/mod.rs index 30b8d6a..cb624a6 100644 --- a/mea/src/semaphore/mod.rs +++ b/mea/src/semaphore/mod.rs @@ -201,9 +201,13 @@ impl Semaphore { /// Acquires `n` permits from the semaphore. /// - /// If the permits are not immediately available, this method will wait until - /// they become available. Returns a [`SemaphorePermit`] that will release the - /// permits when dropped. + /// If the permits are not immediately available, this method will wait until they become + /// available. Returns a [`SemaphorePermit`] that will release the permits when dropped. + /// + /// # Cancel safety + /// + /// This method uses a queue to fairly distribute permits in the order they were requested. + /// Cancelling a call to `acquire` makes you lose your place in the queue. /// /// # Examples ///