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/mpsc | |
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/mpsc')
-rw-r--r-- | tokio/src/sync/mpsc/bounded.rs | 2 | ||||
-rw-r--r-- | tokio/src/sync/mpsc/chan.rs | 6 |
2 files changed, 4 insertions, 4 deletions
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<T, S> Drop for Chan<T, S> { } } -use crate::sync::semaphore::TryAcquireError; +use crate::sync::semaphore_ll::TryAcquireError; impl From<TryAcquireError> for TrySendError { fn from(src: TryAcquireError) -> TrySendError { @@ -398,9 +398,9 @@ impl From<TryAcquireError> 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 { |