Skip to content

Commit d155388

Browse files
Merge pull request #1986 from coldav/colin/fix_native_cpu_missing_mutex
Fix missing mutex on get_alloc_info_entry
2 parents cabf128 + e316c04 commit d155388

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

source/adapters/native_cpu/context.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,9 @@ struct ur_context_handle_t_ : RefCounted {
109109
return UR_RESULT_SUCCESS;
110110
}
111111

112-
const native_cpu::usm_alloc_info &
113-
get_alloc_info_entry(const void *ptr) const {
112+
// Note this is made non-const to access the mutex
113+
const native_cpu::usm_alloc_info &get_alloc_info_entry(const void *ptr) {
114+
std::lock_guard<std::mutex> lock(alloc_mutex);
114115
auto it = allocations.find(ptr);
115116
if (it == allocations.end()) {
116117
return native_cpu::usm_alloc_info_null_entry;

0 commit comments

Comments
 (0)