Skip to content
Permalink
Browse files

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.
  • Loading branch information...
lioncash committed Jul 29, 2019
1 parent a565e41 commit 3f947f086fdc29765594bcaea8ed7fb528e8edbc
Showing with 4 additions and 4 deletions.
  1. +4 −4 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<std::mutex> 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<std::mutex> 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<std::mutex> 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<std::mutex> lock(s_messages_mutex);
std::lock_guard lock{s_messages_mutex};
s_messages.clear();
}
} // namespace OSD

0 comments on commit 3f947f0

Please sign in to comment.
You can’t perform that action at this time.