diff --git a/plugins/GSdx/GSThread_CXX11.h b/plugins/GSdx/GSThread_CXX11.h index 8587186539..6aa54da977 100644 --- a/plugins/GSdx/GSThread_CXX11.h +++ b/plugins/GSdx/GSThread_CXX11.h @@ -34,6 +34,7 @@ private: ringbuffer_base m_queue; std::mutex m_lock; + std::mutex m_wait_lock; std::condition_variable m_empty; std::condition_variable m_notempty; @@ -64,8 +65,13 @@ private: int32_t old_count = m_count.fetch_sub(consumed); - if (old_count == consumed) + if (old_count == consumed) { + + { + std::lock_guard wait_guard(m_wait_lock); + } m_empty.notify_one(); + } } } @@ -110,7 +116,7 @@ public: void Wait() { if (m_count > 0) { - std::unique_lock l(m_lock); + std::unique_lock l(m_wait_lock); while (m_count > 0) { m_empty.wait(l); }