Skip to main content

Module thread

Module thread 

Source

Structs§

AccessError
An error returned by LocalKey::try_with.
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).
LocalKey
A thread local storage (TLS) key which owns its contents.
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 an estimate of the default amount of parallelism a program should use.
current
Gets a handle to the thread that invokes it.
name
panicking
Determines whether the current thread is panicking.
park
Blocks unless or until the current thread’s token is made available.
park_timeout
Blocks unless or until the current thread’s token is made available or the specified duration has been reached (may wake spuriously).
park_timeout_msDeprecated
Uses park_timeout.
scope
Creates a scope for spawning scoped threads.
sleep
Puts the current thread to sleep for at least the specified amount of time.
sleep_msDeprecated
Uses sleep.
spawn
Spawn an OS thread.
spawn_scoped
Spawn a scoped OS thread.
yield_now
Cooperatively gives up a timeslice to the OS scheduler.
add_spawn_hookExperimental
Registers a function to run for every newly thread spawned.
current_idExperimental
Gets the unique identifier of the thread which invokes it.
sleep_untilExperimental
Puts the current thread to sleep until the specified deadline has passed.

Type Aliases§

Result
A specialized Result type for threads.