Expand description
A single-threaded executor which executes tasks on the same thread from which they are spawned.
Note: This crate is deprecated in tokio 0.2.x and has been moved and refactored into various places in the
tokiocrate. The closest replacement is to make use oftokio::task::LocalSet::block_onwhich requires thert-utilfeature.
The crate provides:
CurrentThreadis the main type of this crate. It executes tasks on the current thread. The easiest way to start a newCurrentThreadexecutor is to callblock_on_allwith an initial task to seed the executor. All tasks that are being managed by aCurrentThreadexecutor are able to spawn additional tasks by callingspawn.
Application authors will not use this crate directly. Instead, they will use the
tokio crate. Library authors should only depend on tokio-current-thread if they
are building a custom task executor.
For more details, see executor module documentation in the Tokio crate.
Structs§
- Block
Error - Error returned by the
block_onfunction. - Current
Thread - Executes tasks on the current thread
- Entered
- A
CurrentThreadinstance bound to a supplied execution context. - Handle
- Handle to spawn a future on the corresponding
CurrentThreadinstance - RunError
- Error returned by the
runfunction. - RunTimeout
Error - Error returned by the
run_timeoutfunction. - Task
Executor - Executes futures on the current thread.
- Turn
- Returned by the
turnfunction. - Turn
Error - Error returned by the
turnfunction.
Functions§
- block_
on_ all - Run the executor bootstrapping the execution with the provided future.
- spawn
- Executes a future on the current thread.