Table of Contents

Method fork

Namespace
Alternet.UI
Assembly
Alternet.UI.Common.dll

fork()

Creates a new process by duplicating the calling process.

public static extern int fork()

Returns

int

The process ID of the child process in the parent, 0 in the child process, or -1 if an error occurs.

Remarks

This method is a direct wrapper for the POSIX fork system call. It creates a child process that is a copy of the calling process, except for certain differences such as process ID and resource allocations.

The return value distinguishes the parent process from the child process:

  • In the parent process, the return value is the process ID of the child.
  • In the child process, the return value is 0.
  • If an error occurs, the return value is -1, and errno is set to indicate the error.