summaryrefslogtreecommitdiffstats
path: root/src/common/x64/native_clock.cpp
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2020-06-28 00:20:06 +0200
committerFernando Sahmkow <fsahmkow27@gmail.com>2020-06-28 00:20:06 +0200
commit2f8947583f2f0af4058600243d6c1d244e3c4890 (patch)
treea0e7a10c6131efb23d6fdb3ee7fc0de4bd4163af /src/common/x64/native_clock.cpp
parentNvFlinger: Clang Format. (diff)
downloadyuzu-2f8947583f2f0af4058600243d6c1d244e3c4890.tar
yuzu-2f8947583f2f0af4058600243d6c1d244e3c4890.tar.gz
yuzu-2f8947583f2f0af4058600243d6c1d244e3c4890.tar.bz2
yuzu-2f8947583f2f0af4058600243d6c1d244e3c4890.tar.lz
yuzu-2f8947583f2f0af4058600243d6c1d244e3c4890.tar.xz
yuzu-2f8947583f2f0af4058600243d6c1d244e3c4890.tar.zst
yuzu-2f8947583f2f0af4058600243d6c1d244e3c4890.zip
Diffstat (limited to 'src/common/x64/native_clock.cpp')
-rw-r--r--src/common/x64/native_clock.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/common/x64/native_clock.cpp b/src/common/x64/native_clock.cpp
index f1bc60fd2..424b39b1f 100644
--- a/src/common/x64/native_clock.cpp
+++ b/src/common/x64/native_clock.cpp
@@ -3,6 +3,7 @@
// Refer to the license.txt file included.
#include <chrono>
+#include <mutex>
#include <thread>
#ifdef _MSC_VER
@@ -52,7 +53,7 @@ NativeClock::NativeClock(u64 emulated_cpu_frequency, u64 emulated_clock_frequenc
}
u64 NativeClock::GetRTSC() {
- rtsc_serialize.lock();
+ std::scoped_lock scope{rtsc_serialize};
_mm_mfence();
const u64 current_measure = __rdtsc();
u64 diff = current_measure - last_measure;
@@ -61,7 +62,6 @@ u64 NativeClock::GetRTSC() {
last_measure = current_measure;
}
accumulated_ticks += diff;
- rtsc_serialize.unlock();
/// The clock cannot be more precise than the guest timer, remove the lower bits
return accumulated_ticks & inaccuracy_mask;
}