0

I've got a thread that waits on a condition variable. I signal that variable in another thread when condition A occurs. However, I also need the waiting thread stop waiting if condition B occurs. A and B should really be separately identified.

Can you wait on two condition variables somehow? What would that look like?

Christopher Pisz
  • 3,757
  • 4
  • 29
  • 65
  • Integrate A & B logics in the predicate on a one cv. – seccpur May 03 '18 at 14:35
  • you can wait on a conditional variable and a predicate. but having to wait on 2 conditional variable is often sign of bad design. – Tyker May 03 '18 at 14:39
  • Mmm. Well i can just have a condition variable that says to continue and then store the reason elsewhere, but that just feels like the opposite of good design. instead of having a condition variable names "m_cacheUpdated", I will have one names "m_somethingHappened". Feels like I am losing some maintainability there. But, if the language doesn't provide it, that's what i have to do. – Christopher Pisz May 03 '18 at 14:43

0 Answers0