doc.rust-lang.org
pub struct AccessError
An error returned by LocalKey::try_with.
struct
std
Stable since 1.26.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn thread(&self) -> &Thread
Extracts a handle to the underlying thread.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn join(self) -> Result<T>
Waits for the associated thread to finish.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn is_finished(&self) -> bool
Checks if the associated thread has finished running its main function.
method
std
Stable since 1.61.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct JoinHandle<T>
An owned permission to join on a thread (block on its termination).
struct
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct ThreadId
A unique identifier for a running thread.
struct
std
Stable since 1.19.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn yield_now()
Cooperatively gives up a timeslice to the OS scheduler.
function
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn spawn<F, T>(f: F) -> super::join_handle::JoinHandle<T>
Spawns a new thread, returning a JoinHandle for it.
function
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn sleep_ms(ms: u32)
Uses sleep.
function
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn sleep(dur: crate::time::Duration)
Puts the current thread to sleep for at least the specified amount of time.
function
std
Stable since 1.4.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn park_timeout_ms(ms: u32)
Uses park_timeout.
function
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn park_timeout(dur: crate::time::Duration)
Blocks unless or until the current thread's token is made available or the specified duration has been reached (may wake spuriously).
function
std
Stable since 1.4.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn park()
Blocks unless or until the current thread's token is made available.
function
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn panicking() -> bool
Determines whether the current thread is panicking.
function
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn available_parallelism() -> io::Result<crate::num::NonZero<usize>>
Returns an estimate of the default amount of parallelism a program should use.
function
std
Stable since 1.59.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn current() -> super::thread::Thread
Gets a handle to the thread that invokes it.
function
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn stack_size(self, size: usize) -> Builder
Sets the size of the stack (in bytes) for the new thread.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub unsafe fn spawn_unchecked<F, T>(self, f: F) -> io::Result<JoinHandle<T>>
Spawns a new thread without any lifetime restrictions by taking ownership of the Builder, and returns an io::Result to its JoinHandle.
method
std
Stable since 1.82.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn spawn_scoped<'scope, 'env, F, T>(self, scope: &'scope Scope<'scope, 'env>, f: F) -> io::Result<ScopedJoinHandle<'scope, T>>
Spawns a new scoped thread using the settings set through this Builder.
method
std
Stable since 1.63.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn spawn<F, T>(self, f: F) -> io::Result<JoinHandle<T>>
Spawns a new thread by taking ownership of the Builder, and returns an io::Result to its JoinHandle.
method
std
Stable since 1.0.0
Version 1.100.0-nightly