DosWaitChild waits for completion of a child process whose execution is asynchronous to that of its parent process. The child process is created by DosExecPgm with a value of 2 specified for execFlag. If the child process has multiple threads, the result code returned by DosWaitChild is the one passed to it by the DosExit request that ends the process.
DosWaitChild also can wait for the completion of descendant processes of a child process before it returns. However, it does not report status for descendant processes.
If there are no child processes (either active, or ended but with a return code), then DosWaitChild returns an error. If no child processes have ended, DosWaitChild can wait until one ends before returning to the parent process.
To verify that a given return code is from a specific child process, the process identifier must be checked.
To wait for all child processes and descendants to end, it is necessary to:
DosWaitChild will wait for any child processes, regardless of whether or not they were executed with a result code (by calling DosExecPgm with a value of 2 for execFlag). DosWaitChild will not return to the caller until a process with a return code ends, or until there are no more child processes (of any type) to wait for.