2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
6 #include <exec/execbase.h>
7 #include <exec/tasks.h>
9 /*****************************************************************************
12 #include <proto/exec.h>
14 AROS_LH1(struct Task
*, FindTaskByPID
,
17 AROS_LHA(ULONG
, id
, D0
),
20 struct ExecBase
*, SysBase
, 166, Exec
)
23 Scan through the task lists searching for the task whose
24 et_UniqueID field matches.
27 id - The task ID to match.
30 Address of the Task control structure that matches, or
34 This function is source-compatible with MorphOS.
44 ******************************************************************************/
52 First up, check ThisTask. It could be NULL because of exec_init.c
54 if (SysBase
->ThisTask
!= NULL
)
56 et
= GetETask(SysBase
->ThisTask
);
57 if (et
!= NULL
&& et
->et_UniqueID
== id
)
58 return SysBase
->ThisTask
;
61 /* Next, go through the ready list */
62 ForeachNode(&SysBase
->TaskReady
, t
)
65 if (et
!= NULL
&& et
->et_UniqueID
== id
)
69 /* Finally, go through the wait list */
70 ForeachNode(&SysBase
->TaskWait
, t
)
73 if (et
!= NULL
&& et
->et_UniqueID
== id
)