diff --git a/src/opencl_wrapper.cpp b/src/opencl_wrapper.cpp index 756a70bc396069e75234245fa81d029b86dfc1a1..fbaa52df79b5accee38790228f717f80e2c51fa4 100644 --- a/src/opencl_wrapper.cpp +++ b/src/opencl_wrapper.cpp @@ -38,6 +38,8 @@ static const std::vector g_opencl_library_paths = { static std::mutex g_initMutex; bool isInit = false; void *handle_{nullptr}; +// ohos musl pthread_atfork func regist is not compatible with dlclose lib. such as libGLES_mali.so in openCL +static const std::string atfork_lib = "/system/lib64/libGLES_mali.so"; bool InitOpenCL() { std::lock_guard lock(g_initMutex); @@ -72,7 +74,9 @@ bool LoadLibraryFromPath(const std::string &library_path, void **handle_ptr) { #define LOAD_OPENCL_FUNCTION_PTR(func_name) \ func_name = reinterpret_cast(dlsym(*handle_ptr, #func_name)); \ if (func_name == nullptr) { \ - UnLoadOpenCLLibrary(*handle_ptr); \ + if (library_path.compare(atfork_lib) != 0) { \ + UnLoadOpenCLLibrary(*handle_ptr); \ + } \ return false; \ }