From 826606479682234c98e4dfa6e616e637a28d4fcc Mon Sep 17 00:00:00 2001 From: danzel Date: Tue, 29 Aug 2017 20:39:55 +1200 Subject: [PATCH] Use recursive_mutex instead of mutex to fix #2902 --- src/core/hle/lock.cpp | 2 +- src/core/hle/lock.h | 2 +- src/core/hle/svc.cpp | 2 +- src/core/memory.cpp | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/core/hle/lock.cpp b/src/core/hle/lock.cpp index 082f689c86..1c24c7ce95 100644 --- a/src/core/hle/lock.cpp +++ b/src/core/hle/lock.cpp @@ -7,5 +7,5 @@ #include namespace HLE { -std::mutex g_hle_lock; +std::recursive_mutex g_hle_lock; } diff --git a/src/core/hle/lock.h b/src/core/hle/lock.h index 8265621e1d..5c99fe9966 100644 --- a/src/core/hle/lock.h +++ b/src/core/hle/lock.h @@ -14,5 +14,5 @@ namespace HLE { * to the emulated memory is not protected by this mutex, and should be avoided in any threads other * than the CPU thread. */ -extern std::mutex g_hle_lock; +extern std::recursive_mutex g_hle_lock; } // namespace HLE diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp index b98938cb4c..dfc36748c1 100644 --- a/src/core/hle/svc.cpp +++ b/src/core/hle/svc.cpp @@ -1334,7 +1334,7 @@ void CallSVC(u32 immediate) { MICROPROFILE_SCOPE(Kernel_SVC); // Lock the global kernel mutex when we enter the kernel HLE. - std::lock_guard lock(HLE::g_hle_lock); + std::lock_guard lock(HLE::g_hle_lock); const FunctionDef* info = GetSVCInfo(immediate); if (info) { diff --git a/src/core/memory.cpp b/src/core/memory.cpp index a3c5f4a9d0..097bc5b47f 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp @@ -183,7 +183,7 @@ T Read(const VAddr vaddr) { } // The memory access might do an MMIO or cached access, so we have to lock the HLE kernel state - std::lock_guard lock(HLE::g_hle_lock); + std::lock_guard lock(HLE::g_hle_lock); PageType type = current_page_table->attributes[vaddr >> PAGE_BITS]; switch (type) { @@ -224,7 +224,7 @@ void Write(const VAddr vaddr, const T data) { } // The memory access might do an MMIO or cached access, so we have to lock the HLE kernel state - std::lock_guard lock(HLE::g_hle_lock); + std::lock_guard lock(HLE::g_hle_lock); PageType type = current_page_table->attributes[vaddr >> PAGE_BITS]; switch (type) {