diff --git a/Source/Core/Common/Src/StdMutex.h b/Source/Core/Common/Src/StdMutex.h index 0d8572eb60..4f79ca8f39 100644 --- a/Source/Core/Common/Src/StdMutex.h +++ b/Source/Core/Common/Src/StdMutex.h @@ -157,15 +157,17 @@ public: #endif } +#ifdef __linux__ // TryAcquireSRWLockExclusive requires Windows 7!! -// bool try_lock() -// { -//#ifdef _WIN32 -// return (0 != TryAcquireSRWLockExclusive(&m_handle)); -//#else -// return !pthread_mutex_trylock(&m_handle); -//#endif -// } + bool try_lock() + { +#ifdef _WIN32 + return (0 != TryAcquireSRWLockExclusive(&m_handle)); +#else + return !pthread_mutex_trylock(&m_handle); +#endif + } +#endif native_handle_type native_handle() { diff --git a/Source/Core/DolphinWX/Src/Frame.h b/Source/Core/DolphinWX/Src/Frame.h index 8b74dcf5f4..4feeaf4b76 100644 --- a/Source/Core/DolphinWX/Src/Frame.h +++ b/Source/Core/DolphinWX/Src/Frame.h @@ -145,7 +145,7 @@ class CFrame : public CRenderFrame #ifdef __WXGTK__ Common::Event panic_event; bool bPanicResult; - std::recursive_mutex keystate_lock; + std::mutex keystate_lock; #endif #if defined(HAVE_XRANDR) && HAVE_XRANDR diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index 5b55ab5bc3..7441fc4c62 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -1023,7 +1023,7 @@ void CFrame::DoStop() { #if defined __WXGTK__ wxMutexGuiLeave(); - std::lock_guard lk(keystate_lock); + std::lock_guard lk(keystate_lock); wxMutexGuiEnter(); #endif // Ask for confirmation in case the user accidentally clicked Stop / Escape diff --git a/Source/Core/DolphinWX/Src/Main.cpp b/Source/Core/DolphinWX/Src/Main.cpp index c0f3ed4709..239f936a21 100644 --- a/Source/Core/DolphinWX/Src/Main.cpp +++ b/Source/Core/DolphinWX/Src/Main.cpp @@ -584,8 +584,8 @@ bool Host_GetKeyState(int keycode) #ifdef _WIN32 return GetAsyncKeyState(keycode); #elif defined __WXGTK__ - std::unique_lock lk(main_frame->keystate_lock, std::try_to_lock); - if (!lk.owns_lock()) + std::unique_lock lk(main_frame->keystate_lock, std::defer_lock); + if (!lk.try_lock()) return false; bool key_pressed;