#include <attrs.h>
Public Member Functions | |
constexpr | ThreadAttrs () |
Initializes attributes to their backend-defined defaults. | |
constexpr | ThreadAttrs (const ThreadAttrs &)=default |
Thread attributes can be copied to share properties between threads. | |
constexpr ThreadAttrs & | operator= (const ThreadAttrs &)=default |
constexpr const char * | name () const |
Name hint as a null-terminated string. Never null. | |
constexpr ThreadAttrs & | set_name (const char *name) |
constexpr ThreadAttrs & | set_name (std::nullptr_t)=delete |
constexpr ThreadPriority | priority () const |
constexpr ThreadAttrs & | set_priority (ThreadPriority priority) |
Sets a thread priority hint. | |
constexpr auto | native_stack () const |
constexpr auto | native_stack_pointer () const |
constexpr auto | native_stack_size () const |
constexpr size_t | stack_size_bytes () const |
Returns the size of the stack in bytes. | |
constexpr ThreadAttrs & | set_stack_size_bytes (size_t stack_size_bytes) |
template<size_t kStackSizeBytes> | |
constexpr ThreadAttrs & | set_stack (ThreadStack< kStackSizeBytes > &stack) |
constexpr ThreadAttrs & | clear_stack () |
Clears a previous call to set_stack . | |
constexpr bool | has_external_stack () const |
Generic attributes of a thread. ThreadAttrs
is used with a ThreadContext
to create threads.
ThreadAtts
provides three attributes: name, priority, stack size, and stack location. These attributes should be considered only as hints – the pw_thread backend may not support them.
|
inlineconstexpr |
True if the ThreadAttrs
use an externally allocated stack, rather than one integrated with the ThreadContext
.
|
inlineconstexpr |
Returns a span of the native stack to use for this thread. The stack may not be in terms of bytes! Backends that use void*
for stacks return a std::byte
span. If the backend doesn't support user-specified stacks,
This function is NOT constexpr
if the backend uses void*
for stacks.
|
inlineconstexpr |
Returns a pointer to the native stack to use for this thread.
|
inlineconstexpr |
Returns the size of the stack in native units (not necessarily bytes), using the native type (typically an unsigned integer).
|
inlineconstexpr |
Sets the thread to use the provided stack, instead of a stack integrated into the ThreadContext
.
|
inlineconstexpr |
Sets the thread stack size to use for a stack provided by the ThreadContext
. If 0, the thread backend's minimum stack size is used.
set_stack()
.