My program has two threads, thread A notifies and thread B waits and calculate.
thread A call notify twice then finish. thread B when notified the first time do some heavy calculation then come back and wait again. It is very possible that when thread B wait for the second time, thread A have already finished and notified long ago.
My question is, is it guaranteed thread B will calculate twice?
I used std::mutex, condition_variable, etc.. a code similar to this
Aucun commentaire:
Enregistrer un commentaire