problem: TryAcquireSRWLockExclusive requires Windows 7 :/. solution kinda: use std::recursive_mutex (CriticalSection on windows) where try_lock is used. Dolphin should work on Vista x64 again.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7313 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Jordan Woyak
2011-03-07 00:16:38 +00:00
parent 3151618cb3
commit 5f87642f23
12 changed files with 37 additions and 36 deletions

View File

@ -145,7 +145,7 @@ class CFrame : public CRenderFrame
#ifdef __WXGTK__
Common::Event panic_event;
bool bPanicResult;
std::mutex keystate_lock;
std::recursive_mutex keystate_lock;
#endif
#if defined(HAVE_XRANDR) && HAVE_XRANDR

View File

@ -1023,7 +1023,7 @@ void CFrame::DoStop()
{
#if defined __WXGTK__
wxMutexGuiLeave();
std::lock_guard<std::mutex> lk(keystate_lock);
std::lock_guard<std::recursive_mutex> lk(keystate_lock);
wxMutexGuiEnter();
#endif
// Ask for confirmation in case the user accidentally clicked Stop / Escape

View File

@ -278,7 +278,7 @@ void GamepadPage::ClearAll(wxCommandEvent&)
// no point in using the real ControllerInterface i guess
ControllerInterface face;
std::lock_guard<std::mutex> lk(m_plugin.controls_lock);
std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock);
controller->UpdateReferences(face);
UpdateGUI();
@ -288,7 +288,7 @@ void GamepadPage::LoadDefaults(wxCommandEvent&)
{
controller->LoadDefaults(g_controller_interface);
std::lock_guard<std::mutex> lk(m_plugin.controls_lock);
std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock);
controller->UpdateReferences(g_controller_interface);
UpdateGUI();
@ -298,7 +298,7 @@ void ControlDialog::SetControl(wxCommandEvent&)
{
control_reference->expression = STR_FROM_WXSTR(textctrl->GetValue());
std::lock_guard<std::mutex> lk(m_plugin.controls_lock);
std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock);
g_controller_interface.UpdateReference(control_reference, m_parent->controller->default_device);
UpdateGUI();
@ -315,7 +315,7 @@ void GamepadPage::SetDevice(wxCommandEvent&)
controller->UpdateDefaultDevice();
// update references
std::lock_guard<std::mutex> lk(m_plugin.controls_lock);
std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock);
controller->UpdateReferences(g_controller_interface);
}
@ -334,7 +334,7 @@ void ControlDialog::ClearControl(wxCommandEvent&)
{
control_reference->expression.clear();
std::lock_guard<std::mutex> lk(m_plugin.controls_lock);
std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock);
g_controller_interface.UpdateReference(control_reference, m_parent->controller->default_device);
UpdateGUI();
@ -358,7 +358,7 @@ void ControlDialog::SetSelectedControl(wxCommandEvent&)
control_reference->expression = STR_FROM_WXSTR(expr);
std::lock_guard<std::mutex> lk(m_plugin.controls_lock);
std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock);
g_controller_interface.UpdateReference(control_reference, m_parent->controller->default_device);
UpdateGUI();
@ -389,7 +389,7 @@ void ControlDialog::AppendControl(wxCommandEvent& event)
control_reference->expression = STR_FROM_WXSTR(expr);
std::lock_guard<std::mutex> lk(m_plugin.controls_lock);
std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock);
g_controller_interface.UpdateReference(control_reference, m_parent->controller->default_device);
UpdateGUI();
@ -397,13 +397,13 @@ void ControlDialog::AppendControl(wxCommandEvent& event)
void GamepadPage::AdjustSetting(wxCommandEvent& event)
{
std::lock_guard<std::mutex> lk(m_plugin.controls_lock);
std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock);
((PadSetting*)((wxControl*)event.GetEventObject())->GetClientData())->UpdateValue();
}
void GamepadPage::AdjustControlOption(wxCommandEvent&)
{
std::lock_guard<std::mutex> lk(m_plugin.controls_lock);
std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock);
m_control_dialog->control_reference->range = (ControlState)(m_control_dialog->range_slider->GetValue()) / SLIDER_TICK_COUNT;
}
@ -423,7 +423,7 @@ void GamepadPage::ClearControl(wxCommandEvent& event)
btn->control_reference->expression.clear();
btn->control_reference->range = 1.0f;
std::lock_guard<std::mutex> lk(m_plugin.controls_lock);
std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock);
controller->UpdateReferences(g_controller_interface);
// update changes
@ -443,7 +443,7 @@ void ControlDialog::DetectControl(wxCommandEvent& event)
// apparently, this makes the "waiting" text work on Linux
wxTheApp->Yield();
std::lock_guard<std::mutex> lk(m_plugin.controls_lock);
std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock);
ControllerInterface::Device::Control* const ctrl = control_reference->Detect(DETECT_WAIT_TIME, dev);
// if we got input, select it in the list
@ -467,7 +467,7 @@ void GamepadPage::DetectControl(wxCommandEvent& event)
// apparently, this makes the "waiting" text work on Linux
wxTheApp->Yield();
std::lock_guard<std::mutex> lk(m_plugin.controls_lock);
std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock);
ControllerInterface::Device::Control* const ctrl = btn->control_reference->Detect(DETECT_WAIT_TIME, dev);
// if we got input, update expression and reference
@ -584,7 +584,7 @@ void GamepadPage::LoadProfile(wxCommandEvent&)
IniFile inifile;
inifile.Load(fname);
std::lock_guard<std::mutex> lk(m_plugin.controls_lock);
std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock);
controller->LoadConfig(inifile.GetOrCreateSection("Profile"));
controller->UpdateReferences(g_controller_interface);
@ -648,7 +648,7 @@ void InputConfigDialog::UpdateDeviceComboBox()
void GamepadPage::RefreshDevices(wxCommandEvent&)
{
std::lock_guard<std::mutex> lk(m_plugin.controls_lock);
std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock);
// refresh devices
g_controller_interface.Shutdown();

View File

@ -24,7 +24,7 @@ void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event))
g_controller_interface.UpdateInput();
// don't want game thread updating input when we are using it here
std::unique_lock<std::mutex> lk(g_controller_interface.update_lock, std::try_to_lock);
std::unique_lock<std::recursive_mutex> lk(g_controller_interface.update_lock, std::try_to_lock);
if (!lk.owns_lock())
return;

View File

@ -595,8 +595,8 @@ bool Host_GetKeyState(int keycode)
#ifdef _WIN32
return GetAsyncKeyState(keycode);
#elif defined __WXGTK__
std::unique_lock<std::mutex> lk(main_frame->keystate_lock, std::defer_lock);
if (!lk.try_lock())
std::unique_lock<std::recursive_mutex> lk(main_frame->keystate_lock, std::try_to_lock);
if (!lk.owns_lock())
return false;
bool key_pressed;