未验证 提交 d74f5f07 编写于 作者: 张泊远yg 提交者: Gitee

update ipc/native/src/core/source/ipc_thread_pool.cpp.

Signed-off-by: Nboyuan zhang <zhangboyuan1@huawei.com>
上级 c8ada594
......@@ -26,9 +26,6 @@ namespace IPC_SINGLE {
static constexpr OHOS::HiviewDFX::HiLogLabel LOG_LABEL = { LOG_CORE, LOG_ID_IPC, "IPCWorkThreadPool" };
#define DBINDER_LOGI(fmt, args...) (void)OHOS::HiviewDFX::HiLog::Info(LOG_LABEL, "%{public}d: " fmt, __LINE__, ##args)
#define DBINDER_LOGE(fmt, args...) (void)OHOS::HiviewDFX::HiLog::Error(LOG_LABEL, "%{public}d: " fmt, __LINE__, ##args)
IPCWorkThreadPool::IPCWorkThreadPool(int maxThreadNum)
: threadSequence_(0),
maxThreadNum_(maxThreadNum + maxThreadNum),
......@@ -58,23 +55,23 @@ bool IPCWorkThreadPool::SpawnThread(int policy, int proto)
return false;
}
std::string threadName = MakeThreadName(proto);
DBINDER_LOGI("SpawnThread Name= %{public}s", threadName.c_str());
ZLOGD(LOG_LABEL, "SpawnThread Name= %{public}s", threadName.c_str());
if (threads_.find(threadName) == threads_.end()) {
auto ipcThread = new (std::nothrow) IPCWorkThread(threadName);
if (ipcThread == nullptr) {
DBINDER_LOGE("create IPCWorkThread object failed");
ZLOGE(LOG_LABEL, "create IPCWorkThread object failed");
return false;
}
sptr<IPCWorkThread> newThread = sptr<IPCWorkThread>(ipcThread);
threads_[threadName] = newThread;
if (proto == IRemoteObject::IF_PROT_DEFAULT) {
idleThreadNum_--;
DBINDER_LOGI("SpawnThread, now idleThreadNum_ =%d", idleThreadNum_);
ZLOGD(LOG_LABEL, "SpawnThread, now idleThreadNum_ =%d", idleThreadNum_);
}
if (proto == IRemoteObject::IF_PROT_DATABUS) {
idleSocketThreadNum_--;
DBINDER_LOGI("SpawnThread, now idleSocketThreadNum_ =%d", idleSocketThreadNum_);
ZLOGD(LOG_LABEL, "SpawnThread, now idleSocketThreadNum_ =%d", idleSocketThreadNum_);
}
newThread->Start(policy, proto, threadName);
......@@ -110,7 +107,7 @@ bool IPCWorkThreadPool::RemoveThread(const std::string &threadName)
idleSocketThreadNum_++;
}
threads_.erase(it);
DBINDER_LOGI("SpawnThread, now idleThreadNum_ =%d", idleSocketThreadNum_);
ZLOGD(LOG_LABEL, "SpawnThread, now idleThreadNum_ =%d", idleSocketThreadNum_);
return true;
}
return false;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册