mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-11 16:49:28 +02:00
Replaced Common::CriticalSection with a std::mutex implementation. 64bit Windows builds now use SRWLocks and ConditionVariables(requires Vista/7, x64 builds will no longer work on Windows XP x64). Tell me if you hate that. Removed Common::EventEx. Common::Event now uses a std::condition_variable impl.(using ConditionVariables on Windows x64, Events on x86, or posix condition variables elsewhere). I experience slight speed improvements with these changes.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7294 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -118,10 +118,12 @@ void ControllerInterface::SetHwnd( void* const hwnd )
|
||||
//
|
||||
bool ControllerInterface::UpdateInput(const bool force)
|
||||
{
|
||||
std::unique_lock<std::mutex> lk(update_lock, std::defer_lock);
|
||||
|
||||
if (force)
|
||||
update_lock.Enter();
|
||||
else if (false == update_lock.TryEnter())
|
||||
return false;
|
||||
lk.lock();
|
||||
else if (!lk.try_lock())
|
||||
return false;
|
||||
|
||||
size_t ok_count = 0;
|
||||
|
||||
@ -137,7 +139,6 @@ bool ControllerInterface::UpdateInput(const bool force)
|
||||
//(*d)->ClearInputState();
|
||||
}
|
||||
|
||||
update_lock.Leave();
|
||||
return (m_devices.size() == ok_count);
|
||||
}
|
||||
|
||||
@ -148,10 +149,12 @@ bool ControllerInterface::UpdateInput(const bool force)
|
||||
//
|
||||
bool ControllerInterface::UpdateOutput(const bool force)
|
||||
{
|
||||
std::unique_lock<std::mutex> lk(update_lock, std::defer_lock);
|
||||
|
||||
if (force)
|
||||
update_lock.Enter();
|
||||
else if (false == update_lock.TryEnter())
|
||||
return false;
|
||||
lk.lock();
|
||||
else if (!lk.try_lock())
|
||||
return false;
|
||||
|
||||
size_t ok_count = 0;
|
||||
|
||||
@ -161,7 +164,6 @@ bool ControllerInterface::UpdateOutput(const bool force)
|
||||
for (;d != e; ++d)
|
||||
(*d)->UpdateOutput();
|
||||
|
||||
update_lock.Leave();
|
||||
return (m_devices.size() == ok_count);
|
||||
}
|
||||
|
||||
@ -470,8 +472,8 @@ void ControllerInterface::UpdateReference(ControllerInterface::ControlReference*
|
||||
else if ('`' == c)
|
||||
{
|
||||
// different device
|
||||
if (false == /*XXX*/(bool)std::getline(ss, dev_str, '`'))
|
||||
break;
|
||||
if (std::getline(ss, dev_str, '`').eof())
|
||||
break; // no terminating '`' character
|
||||
}
|
||||
else
|
||||
ctrl_str += c;
|
||||
|
Reference in New Issue
Block a user