Namespaces
Variants
Actions

Talk:cpp/thread/thread/native handle

From cppreference.com
< Talk:cpp‎ | thread‎ | thread

Most of not all other members of std::thread are described to behave a certain way depending if the thread represented is joinable or not.

However, native_handle description states that the are no exceptions thrown by the function; it does not have noexcept qualifier to back it up; and for default-constructed std::thread it seems reasonable that there may not yet be a native handle resource acquired in the first place.

Hence, it is not clear what behavior to expect.

Currently I'm trying to implement a wrapper (b/c implementation unwinds the stack before calling std::terminate, thus making stack dump not possible; hence desire for a wrapper that does not clobber the stack), and it's not clear what the behavior to implement for non-joinable thread state?

50.241.7.213 08:27, 20 June 2018 (PDT)

The existence and semantics of native_handle are entirely implementation-defined.

We have a separate issue here: when we say "(none)" for exceptions, we often meant that the standard said nothing directly about it, which actually means (if the function is not noexcept) that it may throw implementation-defined exceptions, not that it throws nothing. It'll take a full audit to fix this. T. Canens (talk) 13:36, 20 June 2018 (PDT)