pub(crate) struct Inject<T: 'static> {
shared: Shared<T>,
synced: Mutex<Synced>,
}Expand description
Growable, MPMC queue used to inject new tasks into the scheduler and as an overflow queue when the local, fixed-size, array queue overflows.
Fields§
§synced: Mutex<Synced>Implementations§
Source§impl<T: 'static> Inject<T>
impl<T: 'static> Inject<T>
pub(crate) fn is_empty(&self) -> bool
Sourcepub(crate) fn push_batch<I>(&self, iter: I)
pub(crate) fn push_batch<I>(&self, iter: I)
Pushes several values into the queue.
Sourceunsafe fn push_batch_inner(
&self,
batch_head: RawTask,
batch_tail: RawTask,
num: usize,
)
unsafe fn push_batch_inner( &self, batch_head: RawTask, batch_tail: RawTask, num: usize, )
Inserts several tasks that have been linked together into the queue.
The provided head and tail may be the same task. In this case, a single task is inserted.
§Safety
The caller must own the Notified for each of the num tasks, and
the tasks must be linked from batch_head to batch_tail through
their queue_next fields, with batch_tail’s queue_next unset.
Source§impl<T: 'static> Inject<T>
impl<T: 'static> Inject<T>
pub(crate) fn new() -> Inject<T>
pub(crate) fn is_closed(&self) -> bool
Sourcepub(crate) fn close(&self) -> bool
pub(crate) fn close(&self) -> bool
Closes the injection queue, returns true if the queue is open when the
transition is made.
Sourcepub(crate) fn push(&self, task: Notified<T>)
pub(crate) fn push(&self, task: Notified<T>)
Pushes a value into the queue.
This does nothing if the queue is closed.
pub(crate) fn pop(&self) -> Option<Notified<T>>
Auto Trait Implementations§
impl<T> !Freeze for Inject<T>
impl<T> RefUnwindSafe for Inject<T>where
T: RefUnwindSafe,
impl<T> Send for Inject<T>
impl<T> Sync for Inject<T>
impl<T> Unpin for Inject<T>where
T: Unpin,
impl<T> UnsafeUnpin for Inject<T>
impl<T> UnwindSafe for Inject<T>where
T: UnwindSafe,
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