I'm interested to use the condition_variable to synchronize two threads ( A and B ) that don't share data. A good solution I found surfing the internet is the following one.
class WaitableCondition
I found it here : Paper link
The problem is in two code fragments, the first one follows.
void WaitUntilTrue (void)
{
std::unique_lock<std::mutex> uLock(m_mutex);
m_conditionVar.wait(uLock,[&]{return m_condIsTrue}); //<==== ?????
if (m_autoReset) m_condIsTrue = false;
}
Does spurious wakeup happen in the line with question marks comment ?
The same question is related to the following line code :
if (m_conditionVar.wait_for(uLock, timeoutPeriod, [&] {return m_condIsTrue;}))
....
Thanks