pub struct Executor { /* private fields */ }Expand description
Core task execution engine for the Luminal runtime
The Executor is responsible for scheduling and executing tasks. It maintains a global task queue and a set of worker threads that process tasks using a work-stealing algorithm.
Implementations§
Source§impl Executor
impl Executor
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new executor
This initializes a new executor with worker threads based on the number of available CPU cores.
§Returns
A new Executor instance
Sourcepub fn spawn<F>(&self, future: F) -> JoinHandle<F::Output> ⓘ
pub fn spawn<F>(&self, future: F) -> JoinHandle<F::Output> ⓘ
Sourcepub fn block_on<F>(&self, future: F) -> F::Output
pub fn block_on<F>(&self, future: F) -> F::Output
Blocks the current thread until the provided future completes
This spawns the future as a task and then actively helps execute tasks from the queue until the specified future completes.
§Type Parameters
F- The future type
§Parameters
future- The future to execute and wait for
§Returns
The output of the future
§Panics
Panics if the task times out (after 30 seconds) or the task channel is disconnected
Auto Trait Implementations§
impl Freeze for Executor
impl !RefUnwindSafe for Executor
impl Send for Executor
impl Sync for Executor
impl Unpin for Executor
impl !UnwindSafe for Executor
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