From 3f947f086fdc29765594bcaea8ed7fb528e8edbc Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 28 Jul 2019 23:08:18 -0400 Subject: [PATCH] VideoCommon/OnScreenDisplay: Use deduction guides for std::lock_guard Same behavior without hardcoding the type of the mutex within the lock guards. This means the type of the mutex would be able to be changed without needing to also change all occurrences lock guards are used. --- Source/Core/VideoCommon/OnScreenDisplay.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/Core/VideoCommon/OnScreenDisplay.cpp b/Source/Core/VideoCommon/OnScreenDisplay.cpp index 8868585120..0fb4a55a18 100644 --- a/Source/Core/VideoCommon/OnScreenDisplay.cpp +++ b/Source/Core/VideoCommon/OnScreenDisplay.cpp @@ -80,14 +80,14 @@ static float DrawMessage(int index, const Message& msg, const ImVec2& position, void AddTypedMessage(MessageType type, std::string message, u32 ms, u32 rgba) { - std::lock_guard lock(s_messages_mutex); + std::lock_guard lock{s_messages_mutex}; s_messages.erase(type); s_messages.emplace(type, Message(std::move(message), Common::Timer::GetTimeMs() + ms, rgba)); } void AddMessage(std::string message, u32 ms, u32 rgba) { - std::lock_guard lock(s_messages_mutex); + std::lock_guard lock{s_messages_mutex}; s_messages.emplace(MessageType::Typeless, Message(std::move(message), Common::Timer::GetTimeMs() + ms, rgba)); } @@ -98,7 +98,7 @@ void DrawMessages() return; { - std::lock_guard lock(s_messages_mutex); + std::lock_guard lock{s_messages_mutex}; const u32 now = Common::Timer::GetTimeMs(); float current_x = LEFT_MARGIN * ImGui::GetIO().DisplayFramebufferScale.x; @@ -122,7 +122,7 @@ void DrawMessages() void ClearMessages() { - std::lock_guard lock(s_messages_mutex); + std::lock_guard lock{s_messages_mutex}; s_messages.clear(); } } // namespace OSD