diff --git a/ipc/native/src/core/framework/source/ipc_process_skeleton.cpp b/ipc/native/src/core/framework/source/ipc_process_skeleton.cpp index fe127021bb09ba82f42b795b992e3aab74937006..24258e81fdb2473374b18028b07b309b43074e21 100644 --- a/ipc/native/src/core/framework/source/ipc_process_skeleton.cpp +++ b/ipc/native/src/core/framework/source/ipc_process_skeleton.cpp @@ -421,6 +421,9 @@ void IPCProcessSkeleton::BlockUntilThreadAvailable() if (numExecuting_ > maxIPCThreadNum) { ZLOGE(LOG_LABEL, "numExecuting_++ is %{public}d", numExecuting_); } + if (threadPool_== nullptr) { + return; + } while (numExecuting_ >= threadPool_->GetMaxThreadNum()) { cv_.wait(lock); } @@ -433,7 +436,9 @@ void IPCProcessSkeleton::LockForNumExecuting() CHECK_INSTANCE_EXIT(exitFlag_); std::lock_guard lockGuard(mutex_); numExecuting_++; - + if (threadPool_== nullptr) { + return; + } if (numExecuting_ == threadPool_->GetMaxThreadNum()) { uint64_t curTime = static_cast(std::chrono::duration_cast( std::chrono::steady_clock::now().time_since_epoch()).count()); @@ -447,7 +452,9 @@ void IPCProcessSkeleton::UnlockForNumExecuting() { CHECK_INSTANCE_EXIT(exitFlag_); std::lock_guard lockGuard(mutex_); - + if (threadPool_== nullptr) { + return; + } if (numExecuting_ == threadPool_->GetMaxThreadNum()) { uint64_t curTime = static_cast(std::chrono::duration_cast( std::chrono::steady_clock::now().time_since_epoch()).count());