fork

Command: fork


Description
Thin wrapper to the fork() system function

Parameters
In : -none-
Out: PID(integer) : 0 (for the child)
the child's process ID (for the parent)

Author
R Kupper

Bugs
-

Synopsis
fork -> PID

Examples
1. fork
(Well just kidding...)

2. fork 0 eq {(I'm the child!) = quit} {(I'm the parent!) =} ifelse
Try this several times. You will notice the child message to appear
before or after the parent message "by chance". (Even after the
parent's SLI-prompt...)

File
sli/processes.h
Remarks
A full parallel process of SLI is forked.
Parent and child will execute in parallel. There is no way to know which
will start being executed first.
Child inherits all open files including stdin and stdout from parent!
Thus calling fork interactively from the SLI-prompt will result in
command-line-confusion if both processes end up without quitting.
If fork() cannot be executed an error is raised.

SLI-function spoon (processes.sli) is a more convenient wrapper
to fork!