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/mpsc/bounded.rs | 2 +- tokio/src/sync/mpsc/chan.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'tokio/src/sync/mpsc') diff --git a/tokio/src/sync/mpsc/bounded.rs b/tokio/src/sync/mpsc/bounded.rs index 5cca1596..7294e4d5 100644 --- a/tokio/src/sync/mpsc/bounded.rs +++ b/tokio/src/sync/mpsc/bounded.rs @@ -1,6 +1,6 @@ use crate::sync::mpsc::chan; use crate::sync::mpsc::error::{ClosedError, SendError, TryRecvError, TrySendError}; -use crate::sync::semaphore; +use crate::sync::semaphore_ll as semaphore; use std::fmt; use std::task::{Context, Poll}; diff --git a/tokio/src/sync/mpsc/chan.rs b/tokio/src/sync/mpsc/chan.rs index b6e94d5a..7a15e8b3 100644 --- a/tokio/src/sync/mpsc/chan.rs +++ b/tokio/src/sync/mpsc/chan.rs @@ -382,7 +382,7 @@ impl Drop for Chan { } } -use crate::sync::semaphore::TryAcquireError; +use crate::sync::semaphore_ll::TryAcquireError; impl From for TrySendError { fn from(src: TryAcquireError) -> TrySendError { @@ -398,9 +398,9 @@ impl From for TrySendError { // ===== impl Semaphore for (::Semaphore, capacity) ===== -use crate::sync::semaphore::Permit; +use crate::sync::semaphore_ll::Permit; -impl Semaphore for (crate::sync::semaphore::Semaphore, usize) { +impl Semaphore for (crate::sync::semaphore_ll::Semaphore, usize) { type Permit = Permit; fn new_permit() -> Permit { -- cgit v1.2.3