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 cwait( int *status, int process_id, int action );

Description:
    The cwait function suspends the calling process until the specified
    child process terminates.

    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

    The process_id argument specifies which child process to wait for.  This
    value is returned by the call to the  spawn function that started the
    child process.

    The action argument specifies when the parent process resumes execution.
     The possible values are:

    WAIT_CHILD
        Wait until the specified child process has ended.

    WAIT_GRANDCHILD
        Wait until the specified child process and all of the child
        processes of that child process have ended.


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

    EINVAL
        Invalid action code

    ECHILD
        Invalid process id, or the child does not exist.

    EINTR
        The child process terminated abnormally.


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

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

    void main()
      {
         int   process_id;
         int   status;

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

Classification:
    OS/2

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

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