• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# background_process_manager.h
2
3
4## Overview
5
6The **background_process_manager.h** file declares the APIs for background child process management. You can use these APIs to suppress and unsuppress child processes to prevent child processes from occupying too many system resources and causing system stuttering. The APIs take effect only for the child processes created through [OH_Ability_StartNativeChildProcess](../apis-ability-kit/c-apis-ability-childprocess.md#oh_ability_startnativechildprocess).
7
8**Library**: libbackground_process_manager.z.so
9
10**System capability**: SystemCapability.Resourceschedule.BackgroundProcessManager
11
12**Since**: 15
13
14**Related module**: [BackgroundProcessManager](_background_process_manager.md)
15
16
17## Summary
18
19
20### Types
21
22| Name| Description|
23| -------- | -------- |
24| typedef enum [BackgroundProcessManager_ProcessPriority](_background_process_manager.md#backgroundprocessmanager_processpriority) [BackgroundProcessManager_ProcessPriority](_background_process_manager.md#backgroundprocessmanager_processpriority) | Defines an enum for the child process priority. |
25| typedef enum [BackgroundProcessManager_ErrorCode](_background_process_manager.md#backgroundprocessmanager_errorcode) [BackgroundProcessManager_ErrorCode](_background_process_manager.md#backgroundprocessmanager_errorcode) | Defines an enum for the error codes used by the background child process management. |
26
27
28### Enums
29
30| Name| Description|
31| -------- | -------- |
32| [BackgroundProcessManager_ProcessPriority](_background_process_manager.md#backgroundprocessmanager_processpriority) { [PROCESS_BACKGROUND](_background_process_manager.md) = 1, [PROCESS_INACTIVE](_background_process_manager.md) = 2 } | Enumerates child process priorities. |
33| [BackgroundProcessManager_ErrorCode](_background_process_manager.md#backgroundprocessmanager_errorcode) { [ERR_BACKGROUND_PROCESS_MANAGER_SUCCESS](_background_process_manager.md) = 0, [ERR_BACKGROUND_PROCESS_MANAGER_INVALID_PARAM](_background_process_manager.md) = 401, [ERR_BACKGROUND_PROCESS_MANAGER_REMOTE_ERROR](_background_process_manager.md) = 31800001 } | Enumerates the error codes used by the background child process management. |
34
35
36### Function
37
38| Name| Description|
39| -------- | -------- |
40| int [OH_BackgroundProcessManager_SetProcessPriority](_background_process_manager.md#oh_backgroundprocessmanager_setprocesspriority) (int pid, [BackgroundProcessManager_ProcessPriority](_background_process_manager.md#backgroundprocessmanager_processpriority) priority) | Sets the child process priority. After a child process is suppressed, the CPU resources that can be obtained will be limited. If the scheduling policy of the main process changes, for example, from the background to the foreground, the child process changes with the main process. To suppress the child process, call this API again. |
41| int [OH_BackgroundProcessManager_ResetProcessPriority](_background_process_manager.md#oh_backgroundprocessmanager_resetprocesspriority) (int pid) | Unsuppresses the child process. In this case, the child process follows the scheduling policy of the main process. If the scheduling policy of the main process changes, for example, from the background to the foreground, the child process changes with the main process. The effect is the same as calling **resetProcessPriority**. |
42