pub struct TaskPool { /* private fields */ }Implementations§
Source§impl TaskPool
impl TaskPool
pub fn new( engine: Engine, shared_memory: SharedMemory, interface: SimulatorInterface, ) -> Result<Self>
pub fn create_store(&mut self, host: &Host) -> Result<Store<Host>>
pub async fn instantiate( &mut self, store: &mut Store<Host>, module: &Module, interface: &SimulatorInterface, ) -> Result<Instance>
pub async fn spawn( &mut self, opts: TaskOptions, module: &Module, interface: &SimulatorInterface, ) -> Result<TaskHandle>
pub fn by_id(&self, task_id: u32) -> Option<TaskHandle>
pub fn current(&self) -> TaskHandle
pub async fn current_lock(&self) -> MutexGuard<'_, Task>
pub async fn yield_now()
Sourcepub fn suspend_all(&mut self)
pub fn suspend_all(&mut self)
Prevent context switches from happening until resume_all is called.
Sourcepub async fn resume_all(&mut self) -> Result<bool>
pub async fn resume_all(&mut self) -> Result<bool>
Resumes the scheduler, causing a yield if one is pending
Returns whether resuming the scheduler caused a yield.
Sourcepub async fn cycle_tasks(&mut self) -> bool
pub async fn cycle_tasks(&mut self) -> bool
Switches to the next task in the task pool, if any. Returns whether there are running tasks remaining.
This function will loop through the tasks in a round-robin fashion, giving each task a chance to run before looping back around to the beginning. Only tasks with the highest priority will be considered.
pub async fn run_to_completion(host: &Host) -> Result<()>
pub async fn task_state(&self, task_id: u32) -> Option<TaskState>
pub async fn delete_task(&mut self, task_id: u32)
pub fn start_shutdown(&mut self)
Auto Trait Implementations§
impl Freeze for TaskPool
impl !RefUnwindSafe for TaskPool
impl Send for TaskPool
impl Sync for TaskPool
impl Unpin for TaskPool
impl !UnwindSafe for TaskPool
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more