gsdx: Use lock instead of loop to terminate threads

This commit is contained in:
Jonathan Li 2017-01-02 12:11:14 +00:00 committed by Gregory Hainaut
parent b244de73ca
commit a583fafa37
1 changed files with 7 additions and 7 deletions

View File

@ -44,10 +44,9 @@ private:
while (true) {
while (m_count == 0) {
if (m_exit.load(memory_order_relaxed)) {
m_exit = false;
if (m_exit.load(memory_order_relaxed))
return;
}
m_notempty.wait(l);
}
@ -87,10 +86,11 @@ public:
~GSJobQueue()
{
m_exit = true;
do {
m_notempty.notify_one();
} while (m_exit);
{
std::lock_guard<std::mutex> l(m_lock);
m_exit = true;
}
m_notempty.notify_one();
m_thread.join();
}