std::promis...thread_exit(3)
okay so bestie, welcome to std::promis...thread_exit(3) β the manual page from the C++ Standard Libary manual. Yes, that's the manual name, keep the vibe. This page is about std::promise::set_exception_at_thread_exit, and we're gonna get into it. π
π NAME π
std::promise::set_exception_at_thread_exit β that's the name. Also, the page literally repeats it: std::promise::set_exception_at_thread_exit. It's giving βsay it twice so they know you're serious.β β¨
β¨ Synopsis β¨
Here's the signature, bestie:
void set_exception_at_thread_exit( std::exception_ptr p );
(since C++11) π
So what does it do? It stores the exception pointer p into the shared state without making the state ready immediately. The state gets made ready when the current thread exits, after all variables with thread-local storage duration have been destroyed. lowkey a lil delayed-reaction vibe. π
The operation behaves as though set_value, set_exception, set_value_at_thread_exit, and set_exception_at_thread_exit acquire a single mutex associated with the promise object while updating the promise object. Not me listing all four, but yes, all four. π«Ά
An exception is thrown if there is no shared state or if the shared state already stores a value or exception. π¨
Calls to this function do not introduce data races with calls to get_future (therefore they need not synchronize with each other). no cap, that's the actual note. πΈ
π«Ά Parameters π«Ά
pβ exception pointer to store. The behavior is undefined ifpisnullptr. π¨
π Return value π
(none) β literally none, bestie. π
π Exceptions π
std::future_error on the following conditions:
*thishas no shared state. The error code is set tono_state.- The shared state already stores a value or exception. The error code is set to
promise_already_satisfied.
π Example π
This section is incomplete. Reason: no example. π
Not me showing up to the example section and it's empty β iconic empty-section behavior. π«
π¦ See also π¦
set_exceptionsets the result to indicate an exception (public member function). β¨
π Category π
- Todo no example. π
source/version + date, wrapped in a cute lil sign-off: this page is from http://cppreference.com, dated 2024.06.10, and it's the std::promis...thread_exit(3) page. mwah ππ«Ά
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms