chickadee » posix » process-wait

process-wait #!optional PID NOHANGprocedure

Suspends the current process until the child process with the id PID has terminated using the UNIX system call waitpid(). If PID is not given, then this procedure waits for any child process. If NOHANG is given and not #f then the current process is not suspended. This procedure returns three values:

  • PID or 0, if NOHANG is true and the child process has not terminated yet.
  • #t if the process exited normally or #f otherwise.
  • either the exit status, if the process terminated normally or the signal number that terminated/stopped the process.

Note that suspending the current process implies that all threads are suspended as well.