Skip to content

Commit 250f759

Browse files
committed
add mutex for adapter
1 parent fbecf2a commit 250f759

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

source/loader/layers/sanitizer/asan_interceptor.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ class SanitizerInterceptor {
203203
std::shared_ptr<MemBuffer> getMemBuffer(ur_mem_handle_t MemHandle);
204204

205205
ur_result_t holdAdapter(ur_adapter_handle_t Adapter) {
206+
std::scoped_lock<ur_shared_mutex> Guard(m_AdaptersMutex);
206207
if (m_Adapters.find(Adapter) != m_Adapters.end()) {
207208
return UR_RESULT_SUCCESS;
208209
}
@@ -274,6 +275,7 @@ class SanitizerInterceptor {
274275
logger::Logger &logger;
275276

276277
std::unordered_set<ur_adapter_handle_t> m_Adapters;
278+
ur_shared_mutex m_AdaptersMutex;
277279
};
278280

279281
} // namespace ur_sanitizer_layer

0 commit comments

Comments
 (0)