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:
Jordan Woyak
2011-03-05 06:11:26 +00:00
parent a037ff2358
commit 423018f811
56 changed files with 918 additions and 835 deletions

View File

@ -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;