mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-25 12:55:00 +00:00
Replace recursive_mutex with mutex (#708)
* Replace recursive_mutex with mutex * Move mutex lock outside of ObtainBuffer
This commit is contained in:
parent
1d8359f828
commit
f514fdfd18
4 changed files with 10 additions and 5 deletions
|
@ -101,7 +101,7 @@ void MemoryManager::Free(PAddr phys_addr, size_t size) {
|
|||
}
|
||||
}
|
||||
for (const auto& [addr, size] : remove_list) {
|
||||
UnmapMemory(addr, size);
|
||||
UnmapMemoryImpl(addr, size);
|
||||
}
|
||||
|
||||
// Mark region as free and attempt to coalesce it with neighbours.
|
||||
|
@ -124,7 +124,7 @@ int MemoryManager::Reserve(void** out_addr, VAddr virtual_addr, size_t size, Mem
|
|||
const auto& vma = FindVMA(mapped_addr)->second;
|
||||
// If the VMA is mapped, unmap the region first.
|
||||
if (vma.IsMapped()) {
|
||||
UnmapMemory(mapped_addr, size);
|
||||
UnmapMemoryImpl(mapped_addr, size);
|
||||
}
|
||||
const size_t remaining_size = vma.base + vma.size - mapped_addr;
|
||||
ASSERT_MSG(vma.type == VMAType::Free && remaining_size >= size);
|
||||
|
@ -233,7 +233,10 @@ int MemoryManager::MapFile(void** out_addr, VAddr virtual_addr, size_t size, Mem
|
|||
|
||||
void MemoryManager::UnmapMemory(VAddr virtual_addr, size_t size) {
|
||||
std::scoped_lock lk{mutex};
|
||||
UnmapMemoryImpl(virtual_addr, size);
|
||||
}
|
||||
|
||||
void MemoryManager::UnmapMemoryImpl(VAddr virtual_addr, size_t size) {
|
||||
const auto it = FindVMA(virtual_addr);
|
||||
const auto& vma_base = it->second;
|
||||
ASSERT_MSG(vma_base.Contains(virtual_addr, size),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue