Questions tagged [conditional-variable]

18 questions
0
votes
1 answer

How to wait and notify at the same time - conditional variable?

So I want to wait until ender has started waiting here is what basically: std::condition_variable avalanche; std::mutex mutex; std::cout << "avalanche" << std::endl; std::thread ender{[&]{ std::unique_lock…
-1
votes
1 answer

unique_lock.lock() causes abort in C++

I am learning C++ threads and i don't understand unique_lock mechanism very well. I reed This Link with Conditional variable, and more examples here but still I have my confusions: 1- So my question clearly is, doesn't unique_lock protect the mutual…
Azzurro94
  • 479
  • 1
  • 7
  • 19
-1
votes
2 answers

How immediately pause a thread?

Assum have two thread that one of them has more priority and they are running on same core (single core), I only want work just one thread at same time.(maybe you say that is not threading paradigm , but actually I just made my problem minimal…
user20688323
1
2