home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tcl2-73c.zip / tcl7.3 / doc / DetachPids.3 < prev    next >
Text File  |  1993-09-09  |  3KB  |  80 lines

  1. '\"
  2. '\" Copyright (c) 1989-1993 The Regents of the University of California.
  3. '\" All rights reserved.
  4. '\"
  5. '\" Permission is hereby granted, without written agreement and without
  6. '\" license or royalty fees, to use, copy, modify, and distribute this
  7. '\" documentation for any purpose, provided that the above copyright
  8. '\" notice and the following two paragraphs appear in all copies.
  9. '\"
  10. '\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
  11. '\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
  12. '\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
  13. '\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  14. '\"
  15. '\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
  16. '\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  17. '\" AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
  18. '\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
  19. '\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  20. '\" 
  21. '\" $Header: /user6/ouster/tcl/man/RCS/DetachPids.3,v 1.10 93/09/09 10:53:24 ouster Exp $ SPRITE (Berkeley)
  22. '\" 
  23. .so man.macros
  24. .HS Tcl_DetachPids tclc
  25. .BS
  26. .SH NAME
  27. Tcl_DetachPids, Tcl_ReapDetachedProcs \- manage child processes in background
  28. .SH SYNOPSIS
  29. .nf
  30. \fB#include <tcl.h>\fR
  31. .sp
  32. \fBTcl_DetachPids\fR(\fInumPids, pidPtr\fR)
  33. .sp
  34. .VS
  35. \fBTcl_ReapDetachedProcs\fR()
  36. .VE
  37. .SH ARGUMENTS
  38. .AS int *statusPtr
  39. .AP int numPids in
  40. Number of process ids contained in the array pointed to by \fIpidPtr\fR.
  41. .AP int *pidPtr in
  42. Address of array containing \fInumPids\fR process ids.
  43. .BE
  44.  
  45. .SH DESCRIPTION
  46. .PP
  47. .VS
  48. \fBTcl_DetachPids\fR and \fBTcl_ReapDetachedProcs\fR provide a
  49. mechanism for managing subprocesses that are running in background.
  50. These procedures are needed because the parent of a process must
  51. eventually invoke the \fBwaitpid\fR kernel call (or one of a few other
  52. similar kernel calls) to wait for the child to exit.  Until the
  53. parent waits for the child, the child's state cannot be completely
  54. reclaimed by the system.  If a parent continually creates children
  55. and doesn't wait on them, the system's process table will eventually
  56. overflow, even if all the children have exited.
  57. .PP
  58. \fBTcl_DetachPids\fR may be called to ask Tcl to take responsibility
  59. for one or more processes whose process ids are contained in the
  60. \fIpidPtr\fR array passed as argument.  The caller presumably
  61. has started these processes running in background and doesn't
  62. want to have to deal with them again.
  63. .PP
  64. \fBTcl_ReapDetachedProcs\fR invokes the \fBwaitpid\fR kernel call
  65. on each of the background processes so that its state can be cleaned
  66. up if it has exited.  If the process hasn't exited yet,
  67. \fBTcl_ReapDetachedProcs\fR doesn't wait for it to exit;  it will check again
  68. the next time it is invoked.
  69. Tcl automatically calls \fBTcl_ReapDetachedProcs\fR each time the
  70. \fBexec\fR command is executed, so in most cases it isn't necessary
  71. for any code outside of Tcl to invoke \fBTcl_ReapDetachedProcs\fR.
  72. However, if you call \fBTcl_DetachPids\fR in situations where the
  73. \fBexec\fR command may never get executed, you may wish to call
  74. \fBTcl_ReapDetachedProcs\fR from time to time so that background
  75. processes can be cleaned up.
  76. .VE
  77.  
  78. .SH KEYWORDS
  79. background, child, detach, process, wait
  80.