Command: fork

NEST HelpDesk Command Index NEST Quick Reference

Name:
 fork - create a child process of SLI

Synopsis:
 fork -> PID

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)

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...)

Bugs:
 -

Author:
 R Kupper

FirstVersion:
 Mar 17 1999

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!

SeeAlso:spoon sysexec getPID getPPID getPGRP wait waitPID
Source:
 /home/abuild/rpmbuild/BUILD/nest-2.4.1/sli/processes.h

NEST HelpDesk Command Index NEST Quick Reference

© 2000-2010 The NEST Initiative