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 16, 2024
1 parent 0342c95 commit e316c04
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions source/adapters/native_cpu/context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,9 @@ struct ur_context_handle_t_ : RefCounted {
return UR_RESULT_SUCCESS;
}

const native_cpu::usm_alloc_info &
get_alloc_info_entry(const void *ptr) const {
// Note this is made non-const to access the mutex
const native_cpu::usm_alloc_info &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 e316c04

Please sign in to comment.