SWDEV-346423 - avoid race condition
- move removing the array from array set earlier to avoid race condition Signed-off-by: sdashmiz <shadi.dashmiz@amd.com> Change-Id: I9003c991e3e0f47ed0509ddfdbeaa145b5a1e0f1
This commit is contained in:
@@ -627,6 +627,8 @@ hipError_t ihipArrayDestroy(hipArray* array) {
|
||||
amd::ScopedLock lock(hip::hipArraySetLock);
|
||||
if (hip::hipArraySet.find(array) == hip::hipArraySet.end()) {
|
||||
return hipErrorContextIsDestroyed;
|
||||
} else {
|
||||
hip::hipArraySet.erase(array);
|
||||
}
|
||||
}
|
||||
cl_mem memObj = reinterpret_cast<cl_mem>(array->data);
|
||||
@@ -642,10 +644,6 @@ hipError_t ihipArrayDestroy(hipArray* array) {
|
||||
}
|
||||
|
||||
as_amd(memObj)->release();
|
||||
{
|
||||
amd::ScopedLock lock(hip::hipArraySetLock);
|
||||
hip::hipArraySet.erase(array);
|
||||
}
|
||||
delete array;
|
||||
return hipSuccess;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user