summaryrefslogtreecommitdiffstats
path: root/tokio/src/sync
diff options
context:
space:
mode:
authormental <m3nta1@yahoo.com>2020-09-02 20:37:13 +0100
committerGitHub <noreply@github.com>2020-09-02 12:37:13 -0700
commitc9f5bc29158a6f3a786e9d67df8da31524e8a9c3 (patch)
tree5a5036435833cf80b2bd81165e89a5c57795e9cc /tokio/src/sync
parent5cdb6f8fd6be35f971d8ef7ea8984f4d01965620 (diff)
util: add `const fn` support for internal `LinkedList`. (#2805)
Diffstat (limited to 'tokio/src/sync')
-rw-r--r--tokio/src/sync/batch_semaphore.rs2
-rw-r--r--tokio/src/sync/broadcast.rs2
-rw-r--r--tokio/src/sync/notify.rs6
3 files changed, 6 insertions, 4 deletions
diff --git a/tokio/src/sync/batch_semaphore.rs b/tokio/src/sync/batch_semaphore.rs
index aad6c6f1..c48a911c 100644
--- a/tokio/src/sync/batch_semaphore.rs
+++ b/tokio/src/sync/batch_semaphore.rs
@@ -36,7 +36,7 @@ pub(crate) struct Semaphore {
}
struct Waitlist {
- queue: LinkedList<Waiter>,
+ queue: LinkedList<Waiter, <Waiter as linked_list::Link>::Target>,
closed: bool,
}
diff --git a/tokio/src/sync/broadcast.rs b/tokio/src/sync/broadcast.rs
index a64774ec..9b3de530 100644
--- a/tokio/src/sync/broadcast.rs
+++ b/tokio/src/sync/broadcast.rs
@@ -273,7 +273,7 @@ struct Tail {
closed: bool,
/// Receivers waiting for a value
- waiters: LinkedList<Waiter>,
+ waiters: LinkedList<Waiter, <Waiter as linked_list::Link>::Target>,
}
/// Slot in the buffer
diff --git a/tokio/src/sync/notify.rs b/tokio/src/sync/notify.rs
index 84a94823..def704f2 100644
--- a/tokio/src/sync/notify.rs
+++ b/tokio/src/sync/notify.rs
@@ -10,6 +10,8 @@ use std::ptr::NonNull;
use std::sync::atomic::Ordering::SeqCst;
use std::task::{Context, Poll, Waker};
+type WaitList = LinkedList<Waiter, <Waiter as linked_list::Link>::Target>;
+
/// Notify a single task to wake up.
///
/// `Notify` provides a basic mechanism to notify a single task of an event.
@@ -101,7 +103,7 @@ use std::task::{Context, Poll, Waker};
#[derive(Debug)]
pub struct Notify {
state: AtomicU8,
- waiters: Mutex<LinkedList<Waiter>>,
+ waiters: Mutex<WaitList>,
}
#[derive(Debug)]
@@ -285,7 +287,7 @@ impl Default for Notify {
}
}
-fn notify_locked(waiters: &mut LinkedList<Waiter>, state: &AtomicU8, curr: u8) -> Option<Waker> {
+fn notify_locked(waiters: &mut WaitList, state: &AtomicU8, curr: u8) -> Option<Waker> {
loop {
match curr {
EMPTY | NOTIFIED => {