Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
5573fed7
D
Docs
项目概览
OpenHarmony
/
Docs
大约 1 年 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
5573fed7
编写于
11月 24, 2022
作者:
G
Gloria
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update docs against 10890
Signed-off-by: wusongqing<wusongqing@huawei.com>
上级
d02dd0eb
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
202 addition
and
3 deletion
+202
-3
en/application-dev/reference/apis/js-apis-process.md
en/application-dev/reference/apis/js-apis-process.md
+202
-3
未找到文件。
en/application-dev/reference/apis/js-apis-process.md
浏览文件 @
5573fed7
...
...
@@ -28,11 +28,210 @@ import process from '@ohos.process';
| tid
<sup>
8+
</sup>
| number | Yes| No| Thread ID (TID) of a process.|
## ProcessManager<sup>9+</sup>
Provides APIs for throwing exceptions during the addition of a process.
### process.isAppUid<sup>9+</sup>
isAppUid(v: number): boolean
Checks whether a UID belongs to this application.
**System capability**
: SystemCapability.Utils.Lang
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| v | number | Yes| UID.|
**Return value**
| Type| Description|
| -------- | -------- |
| boolean | Returns
**true**
if the UID is the application's UID; returns
**false**
otherwise.|
**Example**
```
js
let
pro
=
new
process
.
ProcessManager
();
let
result
=
pro
.
isAppUid
(
688
);
```
### process.getUidForName<sup>9+</sup>
getUidForName(v: string): number
Obtains the process UID based on the process name.
**System capability**
: SystemCapability.Utils.Lang
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| v | string | Yes| Name of a process.|
**Return value**
| Type| Description|
| -------- | -------- |
| number | Process UID.|
**Example**
```
js
let
pro
=
new
process
.
ProcessManager
();
let
pres
=
pro
.
getUidForName
(
"
tool
"
);
```
### process.getThreadPriority<sup>9+</sup>
getThreadPriority(v: number): number
Obtains the thread priority based on the specified TID.
**System capability**
: SystemCapability.Utils.Lang
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| v | number | Yes| TID.|
**Return value**
| Type| Description|
| -------- | -------- |
| number | Priority of the thread.|
**Example**
```
js
let
pro
=
new
process
.
ProcessManager
();
let
tid
=
process
.
tid
;
let
pres
=
pro
.
getThreadPriority
(
tid
);
```
### process.getSystemConfig<sup>9+</sup>
getSystemConfig(name: number): number
Obtains the system configuration.
**System capability**
: SystemCapability.Utils.Lang
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| name | number | Yes| System configuration parameter name.|
**Return value**
| Type| Description|
| -------- | -------- |
| number | System configuration obtained.|
**Example**
```
js
let
pro
=
new
process
.
ProcessManager
();
let
_SC_ARG_MAX
=
0
;
let
pres
=
pro
.
getSystemConfig
(
_SC_ARG_MAX
);
```
### process.getEnvironmentVar<sup>9+</sup>
getEnvironmentVar(name: string): string
Obtains the value of an environment variable.
**System capability**
: SystemCapability.Utils.Lang
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| name | string | Yes| Environment variable name.|
**Return value**
| Type| Description|
| -------- | -------- |
| string | Value of the environment variable.|
**Example**
```
js
let
pro
=
new
process
.
ProcessManager
();
let
pres
=
pro
.
getEnvironmentVar
(
"
PATH
"
);
```
### process.exit<sup>9+</sup>
exit(code: number): void
Terminates this process.
Exercise caution when using this API.
**System capability**
: SystemCapability.Utils.Lang
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| code | number | Yes| Exit code of the process.|
**Example**
```
js
let
pro
=
new
process
.
ProcessManager
();
pro
.
exit
(
0
);
```
### process.kill<sup>9+</sup>
kill(signal: number, pid: number): boolean
Sends a signal to the specified process to terminate it.
**System capability**
: SystemCapability.Utils.Lang
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pid | number | Yes| PID of the process, to which the signal will be sent.|
| signal | number | Yes| Signal to send.|
**Return value**
| Type| Description|
| -------- | -------- |
| boolean | Returns
**true**
if the signal is sent successfully; returns
**false**
otherwise.|
**Example**
```
js
let
pro
=
new
process
.
ProcessManager
();
let
pres
=
process
.
pid
;
let
result
=
pro
.
kill
(
28
,
pres
);
```
## ChildProcess
Allows a process to obtain the standard input and output of its child processes, send signals, and close its child processes.
### Attributes
**System capability**
: SystemCapability.Utils.Lang
...
...
@@ -193,7 +392,7 @@ let result = process.isIsolatedProcess();
isAppUid(v: number): boolean
Checks whether a UID belongs to this app.
Checks whether a UID belongs to this app
lication
.
**System capability**
: SystemCapability.Utils.Lang
...
...
@@ -207,7 +406,7 @@ Checks whether a UID belongs to this app.
| Type| Description|
| -------- | -------- |
| boolean | Returns
**true**
if the UID is the app's UID; returns
**false**
otherwise.|
| boolean | Returns
**true**
if the UID is the app
lication
's UID; returns
**false**
otherwise.|
**Example**
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录