std::notify_all_at_thread_exit
Defined in header <condition_variable>
|
||
void notify_all_at_thread_exit( std::condition_variable& cond, std::unique_lock<std::mutex> lk ); |
(since C++11) | |
Transfers the ownership of the supplied, previously acquired, lock lk
to internal storage and sets up the execution environment so when the current thread exits, after the destructors for all objects with thread-local storage duration are called, the condition variable is notified as in by
The purpose of this function is to provide a mechanism to determine when all thread_local objects in a detached thread have been destructed. Equivalent effect may be achieved with the facilities provided by Template:cpp or Template:cpp.
Contents |
Notes
Calling this function if lock.mutex()
is not locked by the current thread is undefined behavior.
Calling this function if lock.mutex()
is not the same mutex as the one used by all other threads that are currently waiting on the same condition variable is undefined behavior.
The supplied lock lk
is held until the thread exits. Once this function has been called, no more threads may acquire the same lock in order to wait on cond
. If some thread is waiting on this condition variable, it should not attempt to release and reacquire the lock when it wakes up spuriously.
In typical use cases, this function is the last thing called by a detached thread.
Parameters
cond | - | the condition variable to notify at thread exit |
lk | - | the lock associated with the condition variable cond
|
Return value
(none)