librocdxg: Remove std::call_once to fix repeated libdxcore.so loading failures
The use of std::call_once caused the initialization flag to be set permanently, preventing proper re-attempts to load libdxcore.so when needed. This change removes the once_flag mechanism and relies solely on dxcore_handle_ checks to manage library loading, allowing proper re-initialization attempts. Signed-off-by: yangsu13 <Yang.Su2@amd.com> Reviewed-by: Flora Cui <flora.cui@amd.com>
This commit is contained in:
+13
-16
@@ -55,24 +55,21 @@ DxcoreLoader::~DxcoreLoader() {
|
||||
}
|
||||
|
||||
bool DxcoreLoader::Initialize() {
|
||||
std::call_once(init_flag_, [this]() {
|
||||
// Attempt to load libdxcore.so
|
||||
dlerror(); // Clear error
|
||||
dxcore_handle_ = dlopen("libdxcore.so", RTLD_LAZY);
|
||||
dlerror(); // Clear error
|
||||
dxcore_handle_ = dlopen("libdxcore.so", RTLD_LAZY);
|
||||
|
||||
if (!dxcore_handle_) {
|
||||
pr_err("[DxcoreLoader] Cannot load libdxcore.so: %s\n", dlerror());
|
||||
return;
|
||||
}
|
||||
if (!dxcore_handle_) {
|
||||
pr_err("[DxcoreLoader] Cannot load libdxcore.so: %s\n", dlerror());
|
||||
return false;
|
||||
}
|
||||
|
||||
pr_info("[DxcoreLoader] libdxcore.so loaded successfully\n");
|
||||
if (!LoadDxcoreApis()) {
|
||||
// If API loading failed, close the handle to indicate failure
|
||||
dlclose(dxcore_handle_);
|
||||
dxcore_handle_ = nullptr;
|
||||
return;
|
||||
}
|
||||
});
|
||||
pr_info("[DxcoreLoader] libdxcore.so loaded successfully\n");
|
||||
if (!LoadDxcoreApis()) {
|
||||
// If API loading failed, close the handle to indicate failure
|
||||
dlclose(dxcore_handle_);
|
||||
dxcore_handle_ = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
return IsLoaded();
|
||||
}
|
||||
|
||||
مرجع در شماره جدید
Block a user