Skip to main content

Module thread

Module thread 

Source

Structs§

Duration
A Duration type to represent a span of time, typically used for system timeouts.

Functions§

active_named_thread_count
Returns the number of currently active threads spawned via spawn_named.
assert_main_thread
Panic if called from a non-main thread on wasm32.
assert_not_main_thread
Panic if called from the wasm main thread.
available_parallelism
Returns the number of hardware threads available.
current
Get a handle to the current thread.
current_thread_id
Hash of the current thread’s ID, usable for shard indexing.
is_main_thread
Returns true on native targets.
is_worker_thread
Returns false on native targets.
park
Block until the current thread is explicitly unparked.
park_timeout
Block until unparked or until duration elapses.
sleep
Block the current thread for at least duration.
spawn
Spawn a new thread.
spawn_named
Spawn a new named thread.
yield_now

Type Aliases§

JoinHandle
Thread
ThreadId