Module std::task
Utilities for managing and scheduling tasks
An executing Rust program consists of a collection of tasks, each with their
own stack, and sole ownership of their allocated heap data. Tasks communicate
with each other using channels (see std::comm
for more info about how
communication works).
Failure in one task does not propagate to any others (not to parent, not to child). Failure propagation is instead handled by using the channel send() and recv() methods which will fail if the other end has hung up already.
Task Scheduling:
By default, every task is created with the same "flavor" as the calling task. This flavor refers to the scheduling mode, with two possibilities currently being 1:1 and M:N modes. Green (M:N) tasks are cooperatively scheduled and native (1:1) tasks are scheduled by the OS kernel.
Example
spawn(proc() { println!("Hello, World!"); })
Structs
TaskBuilder | The task builder type. |
TaskOpts | Task configuration options |
Functions
deschedule | Yield control to the task scheduler |
failing | True if the running task has failed |
spawn | Creates and executes a new child task |
task | Generate the base configuration for spawning a task, off of which more configuration methods can be chained. |
try | Execute a function in another task and return either the return value of the function or result::err. |
with_task_name | Read the name of the current task. |
Type Definitions
TaskResult | Indicates the manner in which a task exited. |