summaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2022-04-08 23:01:42 +0200
committerGitHub <noreply@github.com>2022-04-08 23:01:42 +0200
commit04efd729d6b86b133d1ccacfcab77235e247f766 (patch)
tree2a896020311d81e739adf0d2803d589f88ece313 /src/common
parentMerge pull request #8173 from Morph1984/msvc-warn-unused-fn (diff)
parentcore/hle: Standardize scoped_lock initializers (diff)
downloadyuzu-04efd729d6b86b133d1ccacfcab77235e247f766.tar
yuzu-04efd729d6b86b133d1ccacfcab77235e247f766.tar.gz
yuzu-04efd729d6b86b133d1ccacfcab77235e247f766.tar.bz2
yuzu-04efd729d6b86b133d1ccacfcab77235e247f766.tar.lz
yuzu-04efd729d6b86b133d1ccacfcab77235e247f766.tar.xz
yuzu-04efd729d6b86b133d1ccacfcab77235e247f766.tar.zst
yuzu-04efd729d6b86b133d1ccacfcab77235e247f766.zip
Diffstat (limited to 'src/common')
-rw-r--r--src/common/host_memory.cpp4
-rw-r--r--src/common/thread.h2
-rw-r--r--src/common/threadsafe_queue.h4
3 files changed, 5 insertions, 5 deletions
diff --git a/src/common/host_memory.cpp b/src/common/host_memory.cpp
index e829af1ac..802943eb7 100644
--- a/src/common/host_memory.cpp
+++ b/src/common/host_memory.cpp
@@ -149,7 +149,7 @@ public:
}
void Unmap(size_t virtual_offset, size_t length) {
- std::lock_guard lock{placeholder_mutex};
+ std::scoped_lock lock{placeholder_mutex};
// Unmap until there are no more placeholders
while (UnmapOnePlaceholder(virtual_offset, length)) {
@@ -169,7 +169,7 @@ public:
}
const size_t virtual_end = virtual_offset + length;
- std::lock_guard lock{placeholder_mutex};
+ std::scoped_lock lock{placeholder_mutex};
auto [it, end] = placeholders.equal_range({virtual_offset, virtual_end});
while (it != end) {
const size_t offset = std::max(it->lower(), virtual_offset);
diff --git a/src/common/thread.h b/src/common/thread.h
index a8c17c71a..626609372 100644
--- a/src/common/thread.h
+++ b/src/common/thread.h
@@ -17,7 +17,7 @@ namespace Common {
class Event {
public:
void Set() {
- std::lock_guard lk{mutex};
+ std::scoped_lock lk{mutex};
if (!is_set) {
is_set = true;
condvar.notify_one();
diff --git a/src/common/threadsafe_queue.h b/src/common/threadsafe_queue.h
index 2c8c2b90e..7272ac6e8 100644
--- a/src/common/threadsafe_queue.h
+++ b/src/common/threadsafe_queue.h
@@ -52,7 +52,7 @@ public:
// line before cv.wait
// TODO(bunnei): This can be replaced with C++20 waitable atomics when properly supported.
// See discussion on https://github.com/yuzu-emu/yuzu/pull/3173 for details.
- std::lock_guard lock{cv_mutex};
+ std::scoped_lock lock{cv_mutex};
cv.notify_one();
}
@@ -159,7 +159,7 @@ public:
template <typename Arg>
void Push(Arg&& t) {
- std::lock_guard lock{write_lock};
+ std::scoped_lock lock{write_lock};
spsc_queue.Push(t);
}