OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [tcl/] [doc/] [DetachPids.3] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
'\"
2
'\" Copyright (c) 1989-1993 The Regents of the University of California.
3
'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
4
'\"
5
'\" See the file "license.terms" for information on usage and redistribution
6
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
7
'\"
8
'\" RCS: @(#) $Id: DetachPids.3,v 1.1.1.1 2002-01-16 10:25:23 markom Exp $
9
'\"
10
.so man.macros
11
.TH Tcl_DetachPids 3 "" Tcl "Tcl Library Procedures"
12
.BS
13
.SH NAME
14
Tcl_DetachPids, Tcl_ReapDetachedProcs \- manage child processes in background
15
.SH SYNOPSIS
16
.nf
17
\fB#include \fR
18
.sp
19
\fBTcl_DetachPids\fR(\fInumPids, pidPtr\fR)
20
.sp
21
\fBTcl_ReapDetachedProcs\fR()
22
.SH ARGUMENTS
23
.AS int *statusPtr
24
.AP int numPids in
25
Number of process ids contained in the array pointed to by \fIpidPtr\fR.
26
.AP int *pidPtr in
27
Address of array containing \fInumPids\fR process ids.
28
.BE
29
 
30
.SH DESCRIPTION
31
.PP
32
\fBTcl_DetachPids\fR and \fBTcl_ReapDetachedProcs\fR provide a
33
mechanism for managing subprocesses that are running in background.
34
These procedures are needed because the parent of a process must
35
eventually invoke the \fBwaitpid\fR kernel call (or one of a few other
36
similar kernel calls) to wait for the child to exit.  Until the
37
parent waits for the child, the child's state cannot be completely
38
reclaimed by the system.  If a parent continually creates children
39
and doesn't wait on them, the system's process table will eventually
40
overflow, even if all the children have exited.
41
.PP
42
\fBTcl_DetachPids\fR may be called to ask Tcl to take responsibility
43
for one or more processes whose process ids are contained in the
44
\fIpidPtr\fR array passed as argument.  The caller presumably
45
has started these processes running in background and doesn't
46
want to have to deal with them again.
47
.PP
48
\fBTcl_ReapDetachedProcs\fR invokes the \fBwaitpid\fR kernel call
49
on each of the background processes so that its state can be cleaned
50
up if it has exited.  If the process hasn't exited yet,
51
\fBTcl_ReapDetachedProcs\fR doesn't wait for it to exit;  it will check again
52
the next time it is invoked.
53
Tcl automatically calls \fBTcl_ReapDetachedProcs\fR each time the
54
\fBexec\fR command is executed, so in most cases it isn't necessary
55
for any code outside of Tcl to invoke \fBTcl_ReapDetachedProcs\fR.
56
However, if you call \fBTcl_DetachPids\fR in situations where the
57
\fBexec\fR command may never get executed, you may wish to call
58
\fBTcl_ReapDetachedProcs\fR from time to time so that background
59
processes can be cleaned up.
60
 
61
.SH KEYWORDS
62
background, child, detach, process, wait

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.