SWDEV-478065 - Embed host thread in shared_ptr

This shows up in some valgrind runs. Make sure the resources are
released.

Change-Id: I34c25c00370a221585895655744831215136d5f4


[ROCm/clr commit: 4b03017e8a]
This commit is contained in:
Jatin Chaudhary
2024-09-04 09:35:54 +01:00
committed by Jatin Jaikishan Chaudhary
parent 7b2cd9111c
commit 274fd2628f
@@ -186,9 +186,11 @@ void Timestamp::checkGpuTime() {
bool HsaAmdSignalHandler(hsa_signal_value_t value, void* arg) {
Timestamp* ts = reinterpret_cast<Timestamp*>(arg);
amd::Thread* thread = amd::Thread::current();
if (!(thread != nullptr ||
((thread = new amd::HostThread()) != nullptr && thread == amd::Thread::current()))) {
static std::shared_ptr<amd::Thread> thread;
if (amd::Thread::current() == nullptr) {
thread = std::make_shared<amd::HostThread>();
}
if (thread.get() != amd::Thread::current()) {
return false;
}