From 9211adbe01661585cd1831214279262024d04816 Mon Sep 17 00:00:00 2001 From: "Michael P. Jung" Date: Wed, 18 Dec 2019 07:32:12 +0100 Subject: sync: add Semaphore (#1973) Provide an asynchronous Semaphore implementation. This is useful for synchronizing concurrent access to a shared resource. --- tokio/src/sync/mutex.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tokio/src/sync/mutex.rs') 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 Sync for Mutex 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 Mutex { guard } - /// Try to aquire the lock + /// Try to acquire the lock pub fn try_lock(&self) -> Result, TryLockError> { let mut permit = semaphore::Permit::new(); match permit.try_acquire(&self.s) { -- cgit v1.2.3