Define USB 2.0 extension descriptor as Usb20ExtDesc
[AROS.git] / rom / exec / childorphan.c
blobb90da61d4f17075a21a5ba0e16dbdd8b72ad530b
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(ULONG, 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 Forbid();
67 ForeachNode(&et->et_Children, child)
70 Don't need to Remove(), because I'll blow away the entire
71 list at the end of the loop.
73 child->et_Parent = NULL;
75 NEWLIST(&et->et_Children);
76 Permit();
78 else
80 Forbid();
81 child = FindChild(tid);
82 if(child != NULL)
84 child->et_Parent = NULL;
85 Remove((struct Node *)child);
87 else
89 Permit();
90 return CHILD_NOTFOUND;
92 Permit();
94 return 0;
96 AROS_LIBFUNC_EXIT
97 } /* ChildOrphan */