2 Copyright © 1995-2015, The AROS Development Team. All rights reserved.
5 Find out the status of a child task.
7 #include "exec_intern.h"
8 #include <proto/exec.h>
10 /*****************************************************************************
14 AROS_LH1(ULONG
, ChildStatus
,
17 AROS_LHA(ULONG
, tid
, D0
),
20 struct ExecBase
*, SysBase
, 125, Exec
)
23 Return the status of a child task. This allows the Task to
24 determine whether a particular child task is still running or not.
27 tid -- The ID of the task to examine. Note that it is _NOT_
31 One of the CHILD_* values.
34 This function will work correctly only for child tasks that are
35 processes created with NP_NotifyOnDeath set to TRUE. Otherwise
36 it may report CHILD_NOTFOUND even if child already exited.
46 *****************************************************************************/
50 struct Task
*ThisTask
= GET_THIS_TASK
;
53 ULONG status
= CHILD_NOTFOUND
;
55 if ((ThisTask
->tc_Flags
& TF_ETASK
) == 0)
58 et
= ThisTask
->tc_UnionETask
.tc_ETask
;
63 /* Search through the running tasks list */
64 ForeachNode(&et
->et_Children
, child
)
66 if (child
->et_UniqueID
== tid
)
68 status
= CHILD_ACTIVE
;
73 ForeachNode(&et
->et_TaskMsgPort
.mp_MsgList
, child
)
75 if (child
->et_UniqueID
== tid
)
77 status
= CHILD_EXITED
;