Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
communication_ipc
提交
d5a3f99b
C
communication_ipc
项目概览
OpenHarmony
/
communication_ipc
9 个月 前同步成功
通知
20
Star
3
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
communication_ipc
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
d5a3f99b
编写于
7月 14, 2023
作者:
O
openharmony_ci
提交者:
Gitee
7月 14, 2023
浏览文件
操作
浏览文件
下载
差异文件
!734 binder full enhances
Merge pull request !734 from Carmack/master
上级
f26e5635
72f39018
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
50 addition
and
2 deletion
+50
-2
interfaces/innerkits/ipc_core/include/ipc_skeleton.h
interfaces/innerkits/ipc_core/include/ipc_skeleton.h
+13
-0
interfaces/innerkits/ipc_single/libipc_single_map
interfaces/innerkits/ipc_single/libipc_single_map
+2
-1
ipc/native/src/core/include/ipc_process_skeleton.h
ipc/native/src/core/include/ipc_process_skeleton.h
+1
-0
ipc/native/src/core/include/ipc_thread_pool.h
ipc/native/src/core/include/ipc_thread_pool.h
+4
-0
ipc/native/src/core/source/ipc_process_skeleton.cpp
ipc/native/src/core/source/ipc_process_skeleton.cpp
+7
-0
ipc/native/src/core/source/ipc_skeleton.cpp
ipc/native/src/core/source/ipc_skeleton.cpp
+8
-0
ipc/native/src/core/source/ipc_thread_pool.cpp
ipc/native/src/core/source/ipc_thread_pool.cpp
+15
-1
未找到文件。
interfaces/innerkits/ipc_core/include/ipc_skeleton.h
浏览文件 @
d5a3f99b
...
...
@@ -163,5 +163,18 @@ public:
*/
static
bool
SetCallingIdentity
(
std
::
string
&
identity
);
};
class
IPCDfx
{
public:
IPCDfx
()
=
default
;
~
IPCDfx
()
=
default
;
/**
* @brief Block until idle ipc thread available.CAUTION: DO NOT USE IT ELSEWHERE EXPECT HICOLLIE!
* @return void
* @since 9
*/
static
void
BlockUntilThreadAvailable
();
};
}
// namespace OHOS
#endif // OHOS_IPC_IPC_SKELETON_H
interfaces/innerkits/ipc_single/libipc_single_map
浏览文件 @
d5a3f99b
...
...
@@ -23,6 +23,7 @@
OHOS::BrokerRegistration::Register*;
OHOS::BrokerRegistration::Unregister*;
OHOS::BrokerRegistration::NewInstance*;
OHOS::IPCDfx*;
OHOS::IPCSkeleton*;
OHOS::IRemoteObject*;
"OHOS::MessageParcel::MessageParcel()";
...
...
@@ -92,4 +93,4 @@
};
local:
*;
};
\ No newline at end of file
};
ipc/native/src/core/include/ipc_process_skeleton.h
浏览文件 @
d5a3f99b
...
...
@@ -102,6 +102,7 @@ public:
sptr
<
IRemoteObject
>
GetRegistryObject
();
bool
SetRegistryObject
(
sptr
<
IRemoteObject
>
&
object
);
void
BlockUntilThreadAvailable
();
#ifndef CONFIG_IPC_SINGLE
bool
AttachRawData
(
uint32_t
fd
,
std
::
shared_ptr
<
InvokerRawData
>
rawData
);
...
...
ipc/native/src/core/include/ipc_thread_pool.h
浏览文件 @
d5a3f99b
...
...
@@ -16,6 +16,7 @@
#ifndef OHOS_IPC_IPC_WORK_THREAD_POOL_H
#define OHOS_IPC_IPC_WORK_THREAD_POOL_H
#include <condition_variable>
#include <functional>
#include <thread>
#include <map>
...
...
@@ -55,6 +56,7 @@ public:
void
UpdateMaxThreadNum
(
int
maxThreadNum
);
int
GetSocketIdleThreadNum
()
const
;
int
GetSocketTotalThreadNum
()
const
;
void
BlockUntilThreadAvailable
();
private:
static
constexpr
int
PROTO_NUM
=
2
;
...
...
@@ -65,6 +67,8 @@ private:
int
idleThreadNum_
;
int
idleSocketThreadNum_
;
std
::
mutex
mutex_
;
int
numWaitingForThreads_
;
std
::
condition_variable
cv_
;
static
constexpr
HiviewDFX
::
HiLogLabel
LABEL
=
{
LOG_CORE
,
LOG_ID_IPC
,
"IPCWorkThreadPool"
};
};
#ifdef CONFIG_IPC_SINGLE
...
...
ipc/native/src/core/source/ipc_process_skeleton.cpp
浏览文件 @
d5a3f99b
...
...
@@ -307,6 +307,13 @@ sptr<IRemoteObject> IPCProcessSkeleton::QueryObject(const std::u16string &descri
return
current
->
QueryObject
(
descriptor
);
}
void
IPCProcessSkeleton
::
BlockUntilThreadAvailable
()
{
if
(
threadPool_
!=
nullptr
)
{
threadPool_
->
BlockUntilThreadAvailable
();
}
}
#ifndef CONFIG_IPC_SINGLE
sptr
<
IRemoteObject
>
IPCProcessSkeleton
::
GetSAMgrObject
()
{
...
...
ipc/native/src/core/source/ipc_skeleton.cpp
浏览文件 @
d5a3f99b
...
...
@@ -209,4 +209,12 @@ bool IPCSkeleton::SetCallingIdentity(std::string &identity)
return
true
;
}
void
IPCDfx
::
BlockUntilThreadAvailable
()
{
IPCProcessSkeleton
*
current
=
IPCProcessSkeleton
::
GetCurrent
();
if
(
current
!=
nullptr
)
{
current
->
BlockUntilThreadAvailable
();
}
}
}
// namespace OHOS
ipc/native/src/core/source/ipc_thread_pool.cpp
浏览文件 @
d5a3f99b
...
...
@@ -30,7 +30,8 @@ IPCWorkThreadPool::IPCWorkThreadPool(int maxThreadNum)
:
threadSequence_
(
0
),
maxThreadNum_
(
maxThreadNum
+
maxThreadNum
),
idleThreadNum_
(
maxThreadNum
),
idleSocketThreadNum_
(
maxThreadNum
)
idleSocketThreadNum_
(
maxThreadNum
),
numWaitingForThreads_
(
0
)
{}
IPCWorkThreadPool
::~
IPCWorkThreadPool
()
...
...
@@ -102,6 +103,9 @@ bool IPCWorkThreadPool::RemoveThread(const std::string &threadName)
}
if
(
workThread
->
proto_
==
IRemoteObject
::
IF_PROT_DEFAULT
)
{
idleThreadNum_
++
;
if
(
numWaitingForThreads_
>
0
)
{
cv_
.
notify_all
();
}
}
else
if
(
workThread
->
proto_
==
IRemoteObject
::
IF_PROT_DATABUS
)
{
idleSocketThreadNum_
++
;
}
...
...
@@ -142,6 +146,16 @@ void IPCWorkThreadPool::UpdateMaxThreadNum(int maxThreadNum)
idleThreadNum_
+=
diff
/
PROTO_NUM
;
idleSocketThreadNum_
+=
diff
/
PROTO_NUM
;
}
void
IPCWorkThreadPool
::
BlockUntilThreadAvailable
()
{
std
::
unique_lock
<
std
::
mutex
>
lock
(
mutex_
);
numWaitingForThreads_
++
;
while
(
idleThreadNum_
<=
0
)
{
cv_
.
wait
(
lock
);
}
numWaitingForThreads_
--
;
}
#ifdef CONFIG_IPC_SINGLE
}
// namespace IPC_SINGLE
#endif
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录