diff options
author | Michael P. Jung <michael.jung@terreon.de> | 2019-12-18 07:32:12 +0100 |
---|---|---|
committer | Carl Lerche <me@carllerche.com> | 2019-12-17 22:32:12 -0800 |
commit | 9211adbe01661585cd1831214279262024d04816 (patch) | |
tree | 1ff6d31d91c2a76994ff045a0aeac43e0557ef91 /tokio/src/sync/mutex.rs | |
parent | e5b99b0f7a12ca27b390535b8628f87a61a08eb6 (diff) |
sync: add Semaphore (#1973)
Provide an asynchronous Semaphore implementation. This is useful for
synchronizing concurrent access to a shared resource.
Diffstat (limited to 'tokio/src/sync/mutex.rs')
-rw-r--r-- | tokio/src/sync/mutex.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tokio/src/sync/mutex.rs b/tokio/src/sync/mutex.rs index bee00df4..ec59d695 100644 --- a/tokio/src/sync/mutex.rs +++ b/tokio/src/sync/mutex.rs @@ -35,7 +35,7 @@ //! [`MutexGuard`]: struct.MutexGuard.html use crate::future::poll_fn; -use crate::sync::semaphore; +use crate::sync::semaphore_ll as semaphore; use std::cell::UnsafeCell; use std::error::Error; @@ -74,7 +74,7 @@ unsafe impl<T> Sync for Mutex<T> where T: Send {} unsafe impl<'a, T> Sync for MutexGuard<'a, T> where T: Send + Sync {} /// An enumeration of possible errors associated with a `TryLockResult` -/// which can occur while trying to aquire a lock from the `try_lock` +/// which can occur while trying to acquire a lock from the `try_lock` /// method on a `Mutex`. #[derive(Debug)] pub enum TryLockError { @@ -129,7 +129,7 @@ impl<T> Mutex<T> { guard } - /// Try to aquire the lock + /// Try to acquire the lock pub fn try_lock(&self) -> Result<MutexGuard<'_, T>, TryLockError> { let mut permit = semaphore::Permit::new(); match permit.try_acquire(&self.s) { |