A handle to a thread.
More...
|
|
auto | id () const noexcept -> ThreadId |
| | Gets the thread's unique identifier.
|
| |
| auto | name () const -> Option< ThreadNameString > |
| | Gets the thread's name as a string reference if available.
|
| |
| void | unpark () const noexcept |
| | Atomically makes the handle's token available if it is not already.
|
| |
| void | park () const |
| | Like the public park, but callable on any handle.
|
| |
| void | park_timeout (rstd::time::Duration timeout) const |
| | Like the public park_timeout, but callable on any handle.
|
| |
|
auto | cname () const noexcept -> Option< ref< ffi::CStr > > |
| | Gets the C string representation of the thread name, if available.
|
| |
A handle to a thread.
Threads are represented by the Thread type. Each thread has a unique ThreadId, an optional name, and a parker for blocking/unblocking.
◆ name()
| auto rstd::thread::Thread::name |
( |
| ) |
const -> Option<ThreadNameString> |
|
inline |
Gets the thread's name as a string reference if available.
Returns None if no name was set.
◆ park()
| void rstd::thread::Thread::park |
( |
| ) |
const |
|
inline |
Like the public park, but callable on any handle.
Safety
May only be called from the thread to which this handle belongs.
◆ park_timeout()
Like the public park_timeout, but callable on any handle.
Safety
May only be called from the thread to which this handle belongs.
◆ unpark()
| void rstd::thread::Thread::unpark |
( |
| ) |
const |
|
inlinenoexcept |
Atomically makes the handle's token available if it is not already.
Every thread is equipped with some basic low-level blocking support, via the park() function and the unpark() method. These can be used as a more CPU-efficient implementation of a spinlock.
The documentation for this class was generated from the following files:
- /home/runner/work/rstd/rstd/src/std/thread/thread.cppm
- /home/runner/work/rstd/rstd/src/std/thread/thread.cpp