Fix the Host_GetKeyState deadlock caused by Billiard's latest changes.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7304 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Glenn Rice 2011-03-05 21:58:54 +00:00
parent 9abf449e7c
commit 024a87af7a
5 changed files with 9 additions and 4 deletions

View file

@ -155,6 +155,7 @@ if(OPENMP)
endif() endif()
endif() endif()
if(NOT OPENMP_FOUND) if(NOT OPENMP_FOUND)
add_definitions(-Wno-unknown-pragmas)
message("OpenMP parallelization disabled") message("OpenMP parallelization disabled")
endif() endif()

View file

@ -71,6 +71,10 @@ private:
class Barrier class Barrier
{ {
public: public:
Barrier()
: m_count(2), m_waiting(0)
{}
Barrier(size_t count) Barrier(size_t count)
: m_count(count), m_waiting(0) : m_count(count), m_waiting(0)
{} {}
@ -80,7 +84,7 @@ public:
{ {
std::unique_lock<std::mutex> lk(m_mutex); std::unique_lock<std::mutex> lk(m_mutex);
if (m_count == ++m_waiting) if (m_count >= ++m_waiting)
{ {
m_waiting = 0; m_waiting = 0;
m_condvar.notify_all(); m_condvar.notify_all();

View file

@ -665,7 +665,7 @@ void CFrame::OnHostMessage(wxCommandEvent& event)
break; break;
case IDM_KEYSTATE: case IDM_KEYSTATE:
bKeyStateResult = wxGetKeyState(wxKeyCode(event.GetInt())); bKeyStateResult = wxGetKeyState(wxKeyCode(event.GetInt()));
keystate_event.Set(); keystate_event.Wait();
break; break;
#endif #endif

View file

@ -145,7 +145,7 @@ class CFrame : public CRenderFrame
#ifdef __WXGTK__ #ifdef __WXGTK__
Common::Event panic_event; Common::Event panic_event;
bool bPanicResult; bool bPanicResult;
Common::Event keystate_event; Common::Barrier keystate_event;
bool bKeyStateResult; bool bKeyStateResult;
#endif #endif

View file

@ -1045,7 +1045,7 @@ void CFrame::DoStop()
#ifdef __WXGTK__ #ifdef __WXGTK__
// Make sure the app doesn't hang waiting on a keystate check // Make sure the app doesn't hang waiting on a keystate check
keystate_event.Set(); keystate_event.Wait();
#endif #endif
BootManager::Stop(); BootManager::Stop();