Skip to main content

Module thread

Module thread 

Source
Expand description

Standard-compatible threads and borrowed scopes for the selected backend.

In simulation, panicking() reads the shared OS thread’s unwind flag, not a logical task’s state. It can therefore report another task’s panic while an unwinding destructor yields.

Re-exports§

pub use crate::sync::time::sleep;

Structs§

Builder
Thread factory, which can be used in order to configure the properties of a new thread.
JoinHandle
An owned permission to join on a thread (block on its termination).
Scope
A scope to spawn scoped threads in.
ScopedJoinHandle
An owned permission to join on a scoped thread (block on its termination).
Thread
A handle to a thread.
ThreadId
A unique identifier for a running thread.

Functions§

available_parallelism
Returns available native parallelism, or one logical execution thread in simulation.
current
Gets a handle to the thread that invokes it.
panicking
Determines whether the current thread is panicking.
park
Blocks unless or until the current thread’s token is made available.
scope
Creates a scope for spawning scoped threads.
spawn
Spawns a new thread, returning a JoinHandle for it.
yield_now
Cooperatively gives up a timeslice to the OS scheduler.

Type Aliases§

Result
A specialized Result type for threads.