2 Copyright © 1995-2017, The AROS Development Team. All rights reserved.
5 Desc: Make any children of this task orphans.
8 #include "exec_intern.h"
10 #include <proto/exec.h>
12 /*****************************************************************************
16 AROS_LH1(ULONG
, ChildOrphan
,
19 AROS_LHA(ULONG
, tid
, D0
),
22 struct ExecBase
*, SysBase
, 124, Exec
)
25 ChildOrphan() will detach the specified task from its parent
26 task's 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.
34 tid -- The ID of the task to orphan, or 0 for all tasks. Note
35 that it is NOT the pointer to the task.
38 Will return 0 on success or CHILD_* on an error.
40 The child/children will no longer participate in child task
53 *****************************************************************************/
57 struct Task
*ThisTask
= GET_THIS_TASK
;
58 struct ETask
*et
, *child
;
62 et
= GetETask(ThisTask
);
69 ForeachNode(&et
->et_Children
, child
)
72 Don't need to Remove(), because I'll blow away the entire
73 list at the end of the loop.
75 child
->et_Parent
= NULL
;
77 NEWLIST(&et
->et_Children
);
83 child
= FindChild(tid
);
86 child
->et_Parent
= NULL
;
87 Remove((struct Node
*)child
);
92 return CHILD_NOTFOUND
;