Updated PCI IDs to latest snapshot.
[tangerine.git] / rom / exec / childorphan.c
blob3f55c684f8bda29d3cdbc7830ae6445ce17ff4a5
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Make any children of this task orphans.
6 Lang: english
7 */
8 #include "exec_intern.h"
9 #include "exec_util.h"
10 #include <proto/exec.h>
12 /*****************************************************************************
14 NAME */
16 AROS_LH1(ULONG, ChildOrphan,
18 /* SYNOPSIS */
19 AROS_LHA(APTR, tid, D0),
21 /* LOCATION */
22 struct ExecBase *, SysBase, 124, Exec)
24 /* FUNCTION
25 ChildOrphan() will detach the specified task from the its parent
26 task child task tree. This is useful if the parent task will be
27 exiting, and no longer needs to be told about child task events.
29 Note that the default Task finaliser will orphan any remaining
30 children when the task exits. This function can be used if you just
31 do not wish to be told about a particular task.
33 INPUTS
34 tid -- The ID of the task to orphan, or 0 for all tasks. Note
35 that this is NOT the pointer to the task.
37 RESULT
38 Will return 0 on success or CHILD_* on an error.
40 The child/children will no longer participate in child task
41 actions.
43 NOTES
45 EXAMPLE
47 BUGS
49 SEE ALSO
51 INTERNALS
53 *****************************************************************************/
55 AROS_LIBFUNC_INIT
57 struct Task *this = FindTask(NULL);
58 struct ETask *et, *child;
60 et = GetETask(this);
61 if(et == NULL)
62 return CHILD_NOTNEW;
64 if(tid == 0L)
66 ForeachNode(&et->et_Children, child)
69 Don't need to Remove(), because I'll blow away the entire
70 list at the end of the loop.
72 child->et_Parent = NULL;
74 NEWLIST(&et->et_Children);
76 else
78 child = FindChild((ULONG)tid);
79 if(child != NULL)
81 child->et_Parent = NULL;
82 Remove((struct Node *)child);
84 else
85 return CHILD_NOTFOUND;
87 return 0;
89 AROS_LIBFUNC_EXIT
90 } /* ChildOrphan */