未验证 提交 4eeb715a 编写于 作者: O openharmony_ci 提交者: Gitee

!251 【轻量级 PR】:针对内存耗尽场景下概现线程创建启动失败问题,增加异常捕获

Merge pull request !251 from XiYuhao/N/A
......@@ -17,7 +17,10 @@ SUBSYSTEM_DIR = "//foundation/communication/ipc"
IPC_CORE_ROOT = "$SUBSYSTEM_DIR/ipc/native"
config("libipc_core_private_config") {
cflags_cc = [ "-O2" ]
cflags_cc = [
"-O2",
"-fexceptions",
]
}
ohos_shared_library("ipc_core") {
......
......@@ -20,6 +20,7 @@ config("libipc_single_private_config") {
cflags_cc = [
"-DCONFIG_IPC_SINGLE",
"-O2",
"-fexceptions",
]
}
ohos_shared_library("ipc_single") {
......
......@@ -71,8 +71,14 @@ bool IPCWorkThreadPool::SpawnThread(int policy, int proto)
DBINDER_LOGI("SpawnThread, now idleSocketThreadNum_ =%d", idleSocketThreadNum_);
}
newThread->Start(policy, proto, threadName);
return true;
bool ret = true;
try {
newThread->Start(policy, proto, threadName);
} catch (const std::exception& e) {
DBINDER_LOGI("get exception:%{public}s", e.what());
ret = false;
}
return ret;
}
return false;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册