Skip to content

Commit 2581f1c

Browse files
committed
Try not doing dlclose
1 parent 4131c15 commit 2581f1c

1 file changed

Lines changed: 2 additions & 27 deletions

File tree

highs/util/HighsDynamicLibrary.cpp

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -67,35 +67,10 @@ bool HighsDynamicLibrary::load(const std::string& filename,
6767
void HighsDynamicLibrary::unload() {
6868
if (!handle_) return;
6969

70-
#ifdef HIPO_USES_OPENBLAS
71-
// Openblas creates a thread pool that may still exist after dlclose-ing the
72-
// library, leading to seg fault. blas_shutdown should prevent this, but its
73-
// symbol is not always exposed. If the symbol exists, use it and then call
74-
// dlclose. If the symbol does not exist, avoid calling dlclose.
75-
76-
using shutdown_t = void (*)();
77-
shutdown_t shutdown_fn = nullptr;
78-
if (auto p = dlsym(handle_, "blas_shutdown"))
79-
shutdown_fn = reinterpret_cast<shutdown_t>(p);
80-
else if (auto p = dlsym(handle_, "openblas_shutdown"))
81-
shutdown_fn = reinterpret_cast<shutdown_t>(p);
82-
83-
if (shutdown_fn) {
84-
shutdown_fn();
85-
#if defined(_WIN32) || defined(_WIN64)
86-
FreeLibrary(static_cast<HMODULE>(handle_));
87-
#else
88-
dlclose(handle_);
89-
#endif
90-
}
91-
92-
#else
93-
9470
#if defined(_WIN32) || defined(_WIN64)
95-
FreeLibrary(static_cast<HMODULE>(handle_));
71+
// FreeLibrary(static_cast<HMODULE>(handle_));
9672
#else
97-
dlclose(handle_);
98-
#endif
73+
// dlclose(handle_);
9974
#endif
10075

10176
handle_ = nullptr;

0 commit comments

Comments
 (0)