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:
sdashmiz
2022-07-21 14:13:06 -04:00
committed by Shadi Dashmiz
szülő fefb9ae466
commit d0b9e0a4ff
+2 -4
Fájl megtekintése
@@ -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;
}