Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C/C++ v10.0 : C library - <b>synopsis:</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <process.h>
    int wait( int *status );

Description:
    The wait function suspends the calling process until any of the caller's
    immediate child processes terminate.

    If status is not NULL, it points to a word that will be filled in with
    the termination status word and return code of the terminated child
    process.

    If the child process terminated normally, then the low order byte of the
    status word will be set to 0, and the high order byte will contain the
    low order byte of the return code that the child process passed to the
     DOSEXIT function.  The  DOSEXIT function is called whenever  main
    returns, or  exit or  _exit are explicity called.

    If the child process did not terminate normally, then the high order
    byte of the status word will be set to 0, and the low order byte will
    contain one of the following values:

    1
        Hard-error abort

    2
        Trap operation

    3
        SIGTERM signal not intercepted


Returns:
    The wait function returns the child's process id if the child process
    terminated normally.  Otherwise, wait returns -1 and sets  errno to one
    of the following values:

    ECHILD
        No child processes exist for the calling process.

    EINTR
        The child process terminated abnormally.


See Also:
    cwait, exit, _exit, spawn Functions Functions

Example:
    #include <stdlib.h>
    #include <process.h>

    void main()
      {
         int   process_id, status;

         process_id = spawnl( P_NOWAIT, "child.exe",
                    "child", "parm", NULL );
         wait( &status );
      }

Classification:
    OS/2

Systems:
    QNX, OS/2 1.x(all), OS/2 2.x, NT

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson