InitOpenCL修改

Signed-off-by: cuijiawei14@huawei.com <cuijiawei14@huawei.com>
This commit is contained in:
cuijiawei14@huawei.com 2023-03-14 10:42:08 +08:00
parent 63201d7327
commit ed60190b7e

View File

@ -38,15 +38,17 @@ static const std::vector<std::string> g_opencl_library_paths = {
static std::mutex g_initMutex;
static bool isInit = false;
static bool loadSuccess = false;
static void *handle_{nullptr};
bool InitOpenCL() {
std::lock_guard<std::mutex> lock(g_initMutex);
if (isInit){
return true;
return loadSuccess;
}
isInit = LoadOpenCLLibrary(&handle_);
return isInit;
isInit = true;
loadSuccess = LoadOpenCLLibrary(&handle_);
return loadSuccess;
}
bool UnLoadOpenCLLibrary(void *handle) {