32 Concurrency support library [thread]

32.4 Threads [thread.threads]

32.4.3 Class thread [thread.thread.class]

32.4.3.2 Thread attributes [thread.attributes]


32.4.3.2.1 General [thread.attributes.general]

32.4.3.2.2 Class thread​::​name_hint [thread.attributes.hint]

32.4.3.2.3 Class thread​::​stack_size_hint [thread.attributes.size]


32.4.3.2.1 General [thread.attributes.general]

Thread attributes can be used to define additional implementation-defined behaviors on a thread or jthread object.
The set of thread attribute types contains thread​::​name_hint, thread​::​stack_size_hint, and an implementation-defined set of additional thread-attributes.
When an object of a thread attribute type is passed to a thread or jthread constructor, it may affect the new thread's behavior.

32.4.3.2.2 Class thread​::​name_hint [thread.attributes.hint]

namespace std { template<same_as<char> T> class thread::name_hint { public: constexpr explicit name_hint(basic_string_view<T> n) noexcept; name_hint(name_hint&&) = delete; name_hint(const name_hint&) = delete; private: basic_string_view<T> name; // exposition only }; }
The name_hint thread attribute can be used to set the name of a thread for debugging purposes or platform-specific display mechanisms.
Recommended practice: Implementations should not store the value of the name_hint attribute in the thread or jthread object.
Recommended practice: name is interpreted as a string in the associated character encoding of T (Table 12).
constexpr explicit name_hint(basic_string_view<T> n) noexcept;
Effects: Initializes name with n.

32.4.3.2.3 Class thread​::​stack_size_hint [thread.attributes.size]

namespace std { class thread::stack_size_hint { public: constexpr explicit stack_size_hint(size_t s) noexcept; private: size_t size; // exposition only }; }
stack_size_hint can be used to configure a desired size in bytes for platform-specific storage required for a thread.
[Note 1: 
Such storage is typically used for variables with automatic storage duration.
— end note]
The stack size set by the implementation may be adjusted up or down to meet platform-specific requirements.
If size is zero, the thread attribute is ignored.
constexpr explicit stack_size_hint(size_t s) noexcept;
Effects: Initializes size with s.