The native_child_process.h file declares the APIs used to create a native child process and establish an IPC channel between the main process and child process.
Library: libchild_process.so
System capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 12
Related module: ChildProcess
| Name | Description |
|---|---|
| native_child_process.h | Declares the APIs used to create a native child process and establish an IPC channel between the main process and child process. File to include: <AbilityKit/native_child_process.h> Library: libchild_process.so |
| Name | Description |
|---|---|
| typedef enum Ability_NativeChildProcess_ErrCode Ability_NativeChildProcess_ErrCode | Defines an enum for the error codes used by the native child process module. |
| typedef void(* OH_Ability_OnNativeChildProcessStarted) (int errCode, OHIPCRemoteProxy *remoteProxy) | Defines a callback function for notifying the child process startup result. |
| Name | Description |
|---|---|
Ability_NativeChildProcess_ErrCode { NCP_NO_ERROR = 0, NCP_ERR_INVALID_PARAM = 401, NCP_ERR_NOT_SUPPORTED = 801, NCP_ERR_INTERNAL = 16000050, NCP_ERR_BUSY = 16010001, NCP_ERR_TIMEOUT = 16010002, NCP_ERR_SERVICE_ERROR = 16010003, NCP_ERR_MULTI_PROCESS_DISABLED = 16010004, NCP_ERR_ALREADY_IN_CHILD = 16010005, NCP_ERR_MAX_CHILD_PROCESSES_REACHED = 16010006, NCP_ERR_LIB_LOADING_FAILED = 16010007, NCP_ERR_CONNECTION_FAILED = 16010008 } | Enumerates the error codes used by the native child process module. |
| Name | Description |
|---|---|
| int OH_Ability_CreateNativeChildProcess (const char *libName, OH_Ability_OnNativeChildProcessStarted onProcessStarted) | Creates a child process, loads the specified dynamic library file, and returns the startup result asynchronously through a callback parameter. The callback notification is an independent thread. When implementing the callback function, pay attention to thread synchronization and do not perform time-consuming operations to avoid long-time blocking. |
Currently, only 2-in-1 devices are supported, and only one native child process can be started for a process.