Expand description
§Single-threaded executor
This executor works strictly in a single-threaded environment. In order to spawn a task, use
spawn. To run the executor, use run.
There is no need to create an instance of the executor, it’s automatically provisioned as a thread-local instance.
§Example
use tokio::sync::*;
use yielding_executor::single_threaded::{spawn, start};
let (sender, receiver) = oneshot::channel::<()>();
let _task = spawn(async move {
// Complete when something is received
let _ = receiver.await;
});
// Send data to be received
let _ = sender.send(());
start();Structs§
- Task
- Task information
- Task
Handle - Task handle
Enums§
- Join
Error - Task joining error
Functions§
- evict_
all - Removes all tasks from the executor
- queued_
tasks - Returns tokens for queued tasks
- queued_
tasks_ count - Returns the number of tasks currently in the queue to execute
- reset_
yield_ conditions - Reset execution conditions
- run
- Run tasks until completion of a future
- run_
until - Run the executor until a promise resolves
- run_
while - Run the executor while a function returns true
- spawn
- Spawn a task
- start
- Run the executor
- tasks
- Returns all tasks that haven’t completed yet
- tasks_
count - Returns the number of tasks currently registered with the executor