Merge pull request #3794 from EmptyChaos/frame-advance-race

Core: Add synchronization to state changes (Fix Frame Step and FIFO Player -  Issue 8718)
This commit is contained in:
Mat M
2016-05-22 15:19:16 -04:00
36 changed files with 992 additions and 415 deletions

View File

@ -83,6 +83,7 @@ enum HOST_COMM
WM_USER_STOP = 10,
WM_USER_CREATE,
WM_USER_SETCURSOR,
WM_USER_JOB_DISPATCH,
};
// Used for notification on emulation state

View File

@ -42,8 +42,7 @@ public:
return;
std::unique_lock<std::mutex> lk(m_mutex);
m_condvar.wait(lk, [&]{ return m_flag.IsSet(); });
m_flag.Clear();
m_condvar.wait(lk, [&]{ return m_flag.TestAndClear(); });
}
template<class Rep, class Period>
@ -54,8 +53,7 @@ public:
std::unique_lock<std::mutex> lk(m_mutex);
bool signaled = m_condvar.wait_for(lk, rel_time,
[&]{ return m_flag.IsSet(); });
m_flag.Clear();
[&]{ return m_flag.TestAndClear(); });
return signaled;
}