Skip to content

Commit

Permalink
Fix missing mutex on get_alloc_info_entry
Browse files Browse the repository at this point in the history
  • Loading branch information
coldav committed Aug 15, 2024
1 parent d7e0fad commit 562f212
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion source/adapters/native_cpu/context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,10 @@ struct ur_context_handle_t_ : RefCounted {
return UR_RESULT_SUCCESS;
}

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

0 comments on commit 562f212

Please sign in to comment.