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:
Lioncash
2020-12-29 16:01:12 -05:00
parent 41316daf91
commit a8b0661fb0
23 changed files with 98 additions and 98 deletions

View File

@ -1028,7 +1028,7 @@ void QueueHostJob(std::function<void()> job, bool run_during_stop)
bool send_message = false;
{
std::lock_guard<std::mutex> guard(s_host_jobs_lock);
std::lock_guard guard(s_host_jobs_lock);
send_message = s_host_jobs_queue.empty();
s_host_jobs_queue.emplace(HostJob{std::move(job), run_during_stop});
}
@ -1042,7 +1042,7 @@ void HostDispatchJobs()
// WARNING: This should only run on the Host Thread.
// NOTE: This function is potentially re-entrant. If a job calls
// Core::Stop for instance then we'll enter this a second time.
std::unique_lock<std::mutex> guard(s_host_jobs_lock);
std::unique_lock guard(s_host_jobs_lock);
while (!s_host_jobs_queue.empty())
{
HostJob job = std::move(s_host_jobs_queue.front());