Skip to main content

Module functions

Module functions 

Source
Expand description

Free functions.

Structs§

PanicGuard 🔒
Used to ensure that park and park_timeout do not unwind, as that can cause undefined behavior if not handled correctly (see #102398 for context).

Functions§

available_parallelism
Returns an estimate of the default amount of parallelism a program should use.
panicking
Determines whether the current thread is unwinding because of panic.
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.
sleep
Puts the current thread to sleep for at least the specified amount of time.
sleep_msDeprecated
Uses sleep.
spawn
Spawns a new thread, returning a JoinHandle for it.
yield_now
Cooperatively gives up a timeslice to the OS scheduler.
sleep_untilExperimental
Puts the current thread to sleep until the specified deadline has passed.