SWDEV-444670 - Enable teardown class

Force implicit runtime teardown with a global destructor.

Change-Id: Iabe63dedf5b94fefc98668585c45a61607120669
Этот коммит содержится в:
German Andryeyev
2024-04-12 11:22:15 -04:00
родитель a1e0970d6d
Коммит c95a75a2bf
7 изменённых файлов: 37 добавлений и 14 удалений
+18 -5
Просмотреть файл
@@ -100,11 +100,24 @@ void Runtime::tearDown() {
initialized_ = false;
}
class RuntimeTearDown : public amd::HeapObject {
public:
RuntimeTearDown() {}
~RuntimeTearDown() { /*Runtime::tearDown();*/ }
} runtime_tear_down;
std::vector<ReferenceCountedObject*> RuntimeTearDown::external_;
RuntimeTearDown::~RuntimeTearDown() {
#ifndef _WIN32
if (amd::IS_HIP) {
for (auto it: external_) {
it->release();
}
Runtime::tearDown();
}
#endif
}
void RuntimeTearDown::RegisterObject(ReferenceCountedObject* obj) {
external_.push_back(obj);
}
class RuntimeTearDown runtime_tear_down;
uint ReferenceCountedObject::retain() {
return referenceCount_.fetch_add(1, std::memory_order_relaxed) + 1;