std::counting_semaphore<LeastMaxValue>::~counting_semaphore

From cppreference.com
 
 
Thread support library
Threads
(C++11)
(C++20)
(C++20)
this_thread namespace
(C++11)
(C++11)
(C++11)
Mutual exclusion
(C++11)
Generic lock management
(C++11)
(C++11)
(C++11)
(C++11)(C++11)(C++11)
(C++11)
(C++11)
Condition variables
(C++11)
Semaphores
Latches and barriers
(C++20)
(C++20)
Futures
(C++11)
(C++11)
(C++11)
(C++11)
 
 
~counting_semaphore();
(since C++20)

Destroys the counting_semaphore object.

Preconditions

None, but see notes.

Notes

The current draft for C++20 does not specify the precondition for counting_semaphore's destructor; it was removed by P1633R1.

Presumably, however, it would be dangerous to have any other threads still blocking on acquire(), try_acquire_for(), or try_acquire_until() calls when the counting_semaphore destructor is called. counting_semaphore's destructor is not like ~condition_variable() in that regard, for example.