diff options
author | Merry <git@mary.rs> | 2022-04-07 19:31:48 +0100 |
---|---|---|
committer | Merry <git@mary.rs> | 2022-04-07 19:44:07 +0100 |
commit | 6a071c42d27839d2444903991cef496d94a6c8e3 (patch) | |
tree | e77d52acf83f0a81a7118dc0a439ea7823ee6689 /src/core/perf_stats.cpp | |
parent | 1f275eb0777d5274cea85585c7eb2f8afc63f925 (diff) |
core: Replace lock_guard with scoped_lock
Diffstat (limited to 'src/core/perf_stats.cpp')
-rw-r--r-- | src/core/perf_stats.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/core/perf_stats.cpp b/src/core/perf_stats.cpp index 52c43c8574..6ef459b7a4 100644 --- a/src/core/perf_stats.cpp +++ b/src/core/perf_stats.cpp @@ -53,13 +53,13 @@ PerfStats::~PerfStats() { } void PerfStats::BeginSystemFrame() { - std::lock_guard lock{object_mutex}; + std::scoped_lock lock{object_mutex}; frame_begin = Clock::now(); } void PerfStats::EndSystemFrame() { - std::lock_guard lock{object_mutex}; + std::scoped_lock lock{object_mutex}; auto frame_end = Clock::now(); const auto frame_time = frame_end - frame_begin; @@ -79,7 +79,7 @@ void PerfStats::EndGameFrame() { } double PerfStats::GetMeanFrametime() const { - std::lock_guard lock{object_mutex}; + std::scoped_lock lock{object_mutex}; if (current_index <= IgnoreFrames) { return 0; @@ -91,7 +91,7 @@ double PerfStats::GetMeanFrametime() const { } PerfStatsResults PerfStats::GetAndResetStats(microseconds current_system_time_us) { - std::lock_guard lock{object_mutex}; + std::scoped_lock lock{object_mutex}; const auto now = Clock::now(); // Walltime elapsed since stats were reset @@ -120,7 +120,7 @@ PerfStatsResults PerfStats::GetAndResetStats(microseconds current_system_time_us } double PerfStats::GetLastFrameTimeScale() const { - std::lock_guard lock{object_mutex}; + std::scoped_lock lock{object_mutex}; constexpr double FRAME_LENGTH = 1.0 / 60; return duration_cast<DoubleSecs>(previous_frame_length).count() / FRAME_LENGTH; |