os-wait

$Revision: 5.0.2.4 $

Function

Package: SYSTEM

Arguments: (&optional nowait pid)

This function has been replaced with sys:reap-os-subprocess, which has the same functionality. sys:reap-os-subprocess uses keyword arguments and so gives more control over behavior. Except for the changed argument list, the description of this function and sys:reap-os-subprocess are the same.

If a process is started by the excl:run-shell-command with the wait keyword argument nil, then the process will remain in the system after it completes until either Lisp exits or Lisp executes sys:os-wait (or equivalently sys:reap-os-subprocess) to inquire about the exit status. To prevent the system becoming clogged with processes, a program that spawns a number of processes with :wait nil must be sure to call sys:os-wait (or equivalently sys:reap-os-subprocess) after each process finishes.

Exactly what sys:os-wait does depends on the status of spawned processes and the optional arguments. The pid argument controls what processes might be considered on by sys:os-wait. If pid is -1 (the default), all processes are considered. If pid is 0, only processes in the same process group (as the executing Lisp image) are considered. If pid is a positive integer, only the process with that process id is considered. In the rest of this description, processes means `processes considered by sys:os-wait'. See the Unix documentation of the waitpid() system call.

If there are any processes started by excl:run-shell-command with the argument :wait nil which have exited but for which sys:os-wait has not been run, one of them is selected by the operating system and its status and process id are returned in that order as multiple values.

If there are no such processes which have exited but there are processes which are still running, then the behavior of sys:os-wait depends on the nowait arguments. If it is nil (the default), sys:os-wait will wait (disabling multiprocessing, if necessary) until one of the running processes exits. Then that process's status and id are returned. If nowait is true, sys:os-wait will return two values: nil and the pid argument to sys:os-wait immediately. (0 as the single returned value indicates that there are processes running but none to clean up, in contrast to nil -- no processes running, none to clean up, and multiple values -- a process was cleaned up.)

If there are no running processes, sys:os-wait returns immediately with the values nil, nil.

This function simply calls the Unix function waitpid with the pid and nohang flags. Its behavior is determined by the behavior of that function.

See os_interface.htm for information on running shell programs.

The general documentation description is in introduction.htm. The index is in index.htm.

Copyright (C) 1998-1999, Franz Inc., Berkeley, CA. All Rights Reserved.