Merge pull request #4726 from FearlessTobi/port-2312
Port yuzu-emu/yuzu#2312: "general: Use deducation guides for std::lock_guard and std::unique_lock"
This commit is contained in:
@@ -43,7 +43,7 @@ namespace Pica {
|
||||
|
||||
void DebugContext::DoOnEvent(Event event, void* data) {
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(breakpoint_mutex);
|
||||
std::unique_lock lock{breakpoint_mutex};
|
||||
|
||||
// Commit the rasterizer's caches so framebuffers, render targets, etc. will show on debug
|
||||
// widgets
|
||||
@@ -66,7 +66,7 @@ void DebugContext::DoOnEvent(Event event, void* data) {
|
||||
|
||||
void DebugContext::Resume() {
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(breakpoint_mutex);
|
||||
std::lock_guard lock{breakpoint_mutex};
|
||||
|
||||
// Tell all observers that we are about to resume
|
||||
for (auto& breakpoint_observer : breakpoint_observers) {
|
||||
@@ -282,14 +282,14 @@ void StartPicaTracing() {
|
||||
return;
|
||||
}
|
||||
|
||||
std::lock_guard<std::mutex> lock(pica_trace_mutex);
|
||||
std::lock_guard lock(pica_trace_mutex);
|
||||
pica_trace = std::make_unique<PicaTrace>();
|
||||
|
||||
g_is_pica_tracing = true;
|
||||
}
|
||||
|
||||
void OnPicaRegWrite(PicaTrace::Write write) {
|
||||
std::lock_guard<std::mutex> lock(pica_trace_mutex);
|
||||
std::lock_guard lock(pica_trace_mutex);
|
||||
|
||||
if (!g_is_pica_tracing)
|
||||
return;
|
||||
@@ -307,7 +307,7 @@ std::unique_ptr<PicaTrace> FinishPicaTracing() {
|
||||
g_is_pica_tracing = false;
|
||||
|
||||
// Wait until running tracing is finished
|
||||
std::lock_guard<std::mutex> lock(pica_trace_mutex);
|
||||
std::lock_guard lock(pica_trace_mutex);
|
||||
std::unique_ptr<PicaTrace> ret(std::move(pica_trace));
|
||||
|
||||
return ret;
|
||||
|
@@ -63,14 +63,14 @@ public:
|
||||
/// Constructs the object such that it observes events of the given DebugContext.
|
||||
BreakPointObserver(std::shared_ptr<DebugContext> debug_context)
|
||||
: context_weak(debug_context) {
|
||||
std::unique_lock<std::mutex> lock(debug_context->breakpoint_mutex);
|
||||
std::unique_lock lock{debug_context->breakpoint_mutex};
|
||||
debug_context->breakpoint_observers.push_back(this);
|
||||
}
|
||||
|
||||
virtual ~BreakPointObserver() {
|
||||
auto context = context_weak.lock();
|
||||
if (context) {
|
||||
std::unique_lock<std::mutex> lock(context->breakpoint_mutex);
|
||||
std::unique_lock lock(context->breakpoint_mutex);
|
||||
context->breakpoint_observers.remove(this);
|
||||
|
||||
// If we are the last observer to be destroyed, tell the debugger context that
|
||||
|
Reference in New Issue
Block a user