Sign in Join
FPDoc Onlineexperiment

FpWaitPid function

In unit BaseUnix

Wait for a process to terminate.

Declaration

pascal
function FpWaitpid(pid: TPid; stat_loc: pcint; options: cint): TPid

Description

fpWaitPid waits for a child process with process ID Pid to exit. The value of Pid can be one of the following:

Pid < -1
Causes fpWaitPid to wait for any child process whose process group ID equals the absolute value of pid.
Pid = -1
Causes fpWaitPid to wait for any child process.
Pid = 0
Causes fpWaitPid to wait for any child process whose process group ID equals the one of the calling process.
Pid > 0
Causes fpWaitPid to wait for the child whose process ID equals the value of Pid.

The Options parameter can be used to specify further how fpWaitPid behaves:

WNOHANG
Causes fpWaitpid to return immediately if no child hasexited.
WUNTRACED
Causes fpWaitPid to return also for children which are stopped, but whose status has not yet been reported.
__WCLONE
Causes fpWaitPid also to wait for threads created by the Clone call.

The exit status of the process that caused fpWaitPID is reported in stat_loc or Status.

Upon return, it returns the process id of the process that exited, 0 if no process exited, or -1 in case of failure.

For an example, see fpFork.

Errors

Extended error information can be retrieved using fpgetErrno.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.