Skip to main content

Module functions

Module functions 

Source
Expand description

Free functions.

Re-exportsΒ§

use super::builder::Builder; πŸ”’
use super::current::current; πŸ”’
use super::join_handle::JoinHandle; πŸ”’
use crate::mem::forget; πŸ”’
use crate::num::NonZero; πŸ”’
use crate::sys::thread as imp; πŸ”’
use crate::time::Duration; πŸ”’
use crate::time::Instant; πŸ”’
use crate::io; πŸ”’
use crate::panicking; πŸ”’

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 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.
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.