- int numPids (in)
Number of process ids contained in the array pointed to by
- int *pidPtr (in)
Address of array containing numPids process ids.
Tcl_ReapDetachedProcs() provide a
mechanism for managing subprocesses that are running in background.
These procedures are needed because the parent of a process must
eventually invoke the waitpid kernel call (or one of a few other
similar kernel calls) to wait for the child to exit. Until the
parent waits for the child, the child's state cannot be completely
reclaimed by the system. If a parent continually creates children
and doesn't wait on them, the system's process table will eventually
overflow, even if all the children have exited.
Tcl_DetachPids() may be called to ask Tcl to take
for one or more processes whose process ids are contained in the
pidPtr array passed as argument. The caller presumably
has started these processes running in background and doesn't
want to have to deal with them again.
Tcl_ReapDetachedProcs() invokes the waitpid
on each of the background processes so that its state can be cleaned
up if it has exited. If the process hasn't exited yet,
Tcl_ReapDetachedProcs() doesn't wait for it to exit; it
will check again
the next time it is invoked.
Tcl automatically calls Tcl_ReapDetachedProcs() each time
exec command is executed, so in most cases it isn't
for any code outside of Tcl to invoke
However, if you call Tcl_DetachPids() in situations where
exec command may never get executed, you may wish to call
Tcl_ReapDetachedProcs() from time to time so that
processes can be cleaned up.
Windows Server 2012. Windows 8.1. Windows Server 2012 R2. Windows 10. Windows Server 2016. Windows Server 2019.
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
PTC MKS Toolkit 10.3 Documentation Build 39.