diff options
Diffstat (limited to 'src/common/host_memory.cpp')
| -rw-r--r-- | src/common/host_memory.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/common/host_memory.cpp b/src/common/host_memory.cpp index c465cfc14..802943eb7 100644 --- a/src/common/host_memory.cpp +++ b/src/common/host_memory.cpp | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | #include <fcntl.h> | 18 | #include <fcntl.h> |
| 19 | #include <sys/mman.h> | 19 | #include <sys/mman.h> |
| 20 | #include <unistd.h> | 20 | #include <unistd.h> |
| 21 | #include "common/scope_exit.h" | ||
| 21 | 22 | ||
| 22 | #endif // ^^^ Linux ^^^ | 23 | #endif // ^^^ Linux ^^^ |
| 23 | 24 | ||
| @@ -27,7 +28,6 @@ | |||
| 27 | #include "common/assert.h" | 28 | #include "common/assert.h" |
| 28 | #include "common/host_memory.h" | 29 | #include "common/host_memory.h" |
| 29 | #include "common/logging/log.h" | 30 | #include "common/logging/log.h" |
| 30 | #include "common/scope_exit.h" | ||
| 31 | 31 | ||
| 32 | namespace Common { | 32 | namespace Common { |
| 33 | 33 | ||
| @@ -149,7 +149,7 @@ public: | |||
| 149 | } | 149 | } |
| 150 | 150 | ||
| 151 | void Unmap(size_t virtual_offset, size_t length) { | 151 | void Unmap(size_t virtual_offset, size_t length) { |
| 152 | std::lock_guard lock{placeholder_mutex}; | 152 | std::scoped_lock lock{placeholder_mutex}; |
| 153 | 153 | ||
| 154 | // Unmap until there are no more placeholders | 154 | // Unmap until there are no more placeholders |
| 155 | while (UnmapOnePlaceholder(virtual_offset, length)) { | 155 | while (UnmapOnePlaceholder(virtual_offset, length)) { |
| @@ -169,7 +169,7 @@ public: | |||
| 169 | } | 169 | } |
| 170 | const size_t virtual_end = virtual_offset + length; | 170 | const size_t virtual_end = virtual_offset + length; |
| 171 | 171 | ||
| 172 | std::lock_guard lock{placeholder_mutex}; | 172 | std::scoped_lock lock{placeholder_mutex}; |
| 173 | auto [it, end] = placeholders.equal_range({virtual_offset, virtual_end}); | 173 | auto [it, end] = placeholders.equal_range({virtual_offset, virtual_end}); |
| 174 | while (it != end) { | 174 | while (it != end) { |
| 175 | const size_t offset = std::max(it->lower(), virtual_offset); | 175 | const size_t offset = std::max(it->lower(), virtual_offset); |