Struct tokio::sync::batch_semaphore::Waiter
source · struct Waiter {
state: AtomicUsize,
waker: UnsafeCell<Option<Waker>>,
pointers: Pointers<Waiter>,
_p: PhantomPinned,
}
Expand description
An entry in the wait queue.
Fields§
§state: AtomicUsize
The current state of the waiter.
This is either the number of remaining permits required by the waiter, or a flag indicating that the waiter is not yet queued.
waker: UnsafeCell<Option<Waker>>
The waker to notify the task awaiting permits.
§Safety
This may only be accessed while the wait queue is locked.
pointers: Pointers<Waiter>
Intrusive linked-list pointers.
§Safety
This may only be accessed while the wait queue is locked.
TODO: Ideally, we would be able to use loom to enforce that
this isn’t accessed concurrently. However, it is difficult to
use a UnsafeCell
here, since the Link
trait requires returning
references to Pointers
, and UnsafeCell
requires that checked access
take place inside a closure. We should consider changing Pointers
to
use UnsafeCell
internally.
_p: PhantomPinned
Should not be Unpin
.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Waiter
impl !RefUnwindSafe for Waiter
impl Send for Waiter
impl !Sync for Waiter
impl !Unpin for Waiter
impl !UnwindSafe for Waiter
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more