> "Melzzzzz" wrote in message news:20150724214131.2824a1ce@maxa-pc...
I think not, because a thread can miss a signal...
Think about the following scenario:
__________________________________________
void print_id (int id) {
std::unique_lock<std::mutex> lck(mtx);
while (!ready)
{
//HALT:
cv.wait(lck);
}
// ...
std::cout << "thread " << id << '\n';
}
__________________________________________
If a thread stalls in HALT, and the flag is then changed
to true and then a broadcast occurs, well, this thread
will miss that broadcast.
BAM! Deadlocked!
;^o