Skip to main content

ExecutorQueue

Trait ExecutorQueue 

Source
pub trait ExecutorQueue: Sized {
    // Required methods
    fn new() -> Self;
    fn push(&self, runnable: Runnable);
    fn pop(&self) -> Option<Runnable>;
}
Expand description

A trait abstracting the async executor queue. The queue MUST be thread-safe (and could be ISR-safe if the executor is used in an embedded context).

Pushing and popping items from the queue must NOT block the current thread / the ISR interrupt.

Allocating memory in the push and pop operations is only allowed if the underlying operating system allows allocations from an ISR context, and if the queue is ISR-safe in the first place.

Required Methods§

Source

fn new() -> Self

Creates a new queue.

Source

fn push(&self, runnable: Runnable)

Pushes a runnable into the queue.

Source

fn pop(&self) -> Option<Runnable>

Pop an item from the queue.

Return Some(runnable) if a runnable was successfully popped, or None if the queue is empty.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<M> ExecutorQueue for UnboundQueue<M>
where M: RawMutex,

Source§

impl<const C: usize, M: RawMutex> ExecutorQueue for BoundQueue<C, M>