pub struct AllocExecutor<'a, R, S>where
R: RawMutex,{ /* private fields */ }
Expand description
Alloc-only Future
executor
Assuming the RawMutex
implementation provided is sound, this should be
safe to use in both embedded and non-embedded scenarios. On embedded devices,
it will probably be a type that disables/re-enables interrupts. On real OS’s,
it can be an actual mutex implementation.
The Sleep
implementation can be used to put the event loop into a low-power
state using something like cortex_m::wfi/e
.
Implementations§
Source§impl<'a, R, S> AllocExecutor<'a, R, S>
impl<'a, R, S> AllocExecutor<'a, R, S>
Sourcepub fn with_capacity(registry: usize, queue: usize) -> Self
pub fn with_capacity(registry: usize, queue: usize) -> Self
Initialize a new AllocExecutor
with the given capacities.
Does nothing unless it’s run()
Sourcepub fn spawner(&self) -> Spawner<'a, R>
pub fn spawner(&self) -> Spawner<'a, R>
Get a handle to a Spawner
that can be passed to Future
constructors
to spawn even more Future
s
Sourcepub fn local_spawner(&self) -> LocalSpawner<'a, R>
pub fn local_spawner(&self) -> LocalSpawner<'a, R>
Get a handle to a LocalSpawner
that can be passed to local Future
constructors
to spawn even more local Future
s
Sourcepub fn spawn_raw<F>(&mut self, future: F)where
F: UnsafeFutureObj<'a, ()>,
pub fn spawn_raw<F>(&mut self, future: F)where
F: UnsafeFutureObj<'a, ()>,
Spawn a local UnsafeFutureObj
into the executor.
Sourcepub fn spawn<F>(&mut self, future: F)
pub fn spawn<F>(&mut self, future: F)
Spawn a Future
into the executor.
This will implicitly box the future in order to objectify it.
Sourcepub fn run(&mut self)
pub fn run(&mut self)
Run the executor
Each loop will poll at most one task from the queue and then check for newly spawned tasks. If there are no new tasks spawned and nothing left in the queue, the executor will attempt to sleep.
Once there’s nothing to spawn and nothing left in the registry, the executor will return.