mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-07 08:39:00 +00:00
Core: Make use of C++17 deduction guides with locks
C++17 allows omitting the mutex type, which makes for both less reading and more flexibility (e.g. The mutex type can change and all occurrences don't need to be updated).
This commit is contained in:
parent
41316daf91
commit
a8b0661fb0
23 changed files with 98 additions and 98 deletions
|
@ -116,7 +116,7 @@ void ApplyCodes(const std::vector<ARCode>& codes)
|
|||
if (!SConfig::GetInstance().bEnableCheats)
|
||||
return;
|
||||
|
||||
std::lock_guard<std::mutex> guard(s_lock);
|
||||
std::lock_guard guard(s_lock);
|
||||
s_disable_logging = false;
|
||||
s_active_codes.clear();
|
||||
std::copy_if(codes.begin(), codes.end(), std::back_inserter(s_active_codes),
|
||||
|
@ -144,7 +144,7 @@ std::vector<ARCode> ApplyAndReturnCodes(const std::vector<ARCode>& codes)
|
|||
{
|
||||
if (SConfig::GetInstance().bEnableCheats)
|
||||
{
|
||||
std::lock_guard<std::mutex> guard(s_lock);
|
||||
std::lock_guard guard(s_lock);
|
||||
s_disable_logging = false;
|
||||
s_active_codes.clear();
|
||||
std::copy_if(codes.begin(), codes.end(), std::back_inserter(s_active_codes),
|
||||
|
@ -162,7 +162,7 @@ void AddCode(ARCode code)
|
|||
|
||||
if (code.enabled)
|
||||
{
|
||||
std::lock_guard<std::mutex> guard(s_lock);
|
||||
std::lock_guard guard(s_lock);
|
||||
s_disable_logging = false;
|
||||
s_active_codes.emplace_back(std::move(code));
|
||||
}
|
||||
|
@ -335,13 +335,13 @@ void EnableSelfLogging(bool enable)
|
|||
|
||||
std::vector<std::string> GetSelfLog()
|
||||
{
|
||||
std::lock_guard<std::mutex> guard(s_lock);
|
||||
std::lock_guard guard(s_lock);
|
||||
return s_internal_log;
|
||||
}
|
||||
|
||||
void ClearSelfLog()
|
||||
{
|
||||
std::lock_guard<std::mutex> guard(s_lock);
|
||||
std::lock_guard guard(s_lock);
|
||||
s_internal_log.clear();
|
||||
}
|
||||
|
||||
|
@ -979,7 +979,7 @@ void RunAllActive()
|
|||
// If the mutex is idle then acquiring it should be cheap, fast mutexes
|
||||
// are only atomic ops unless contested. It should be rare for this to
|
||||
// be contested.
|
||||
std::lock_guard<std::mutex> guard(s_lock);
|
||||
std::lock_guard guard(s_lock);
|
||||
s_active_codes.erase(std::remove_if(s_active_codes.begin(), s_active_codes.end(),
|
||||
[](const ARCode& code) {
|
||||
bool success = RunCodeLocked(code);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue