1 #include <exec/execbase.h>
2 #include <exec/tasks.h>
4 /*****************************************************************************
7 #include <proto/exec.h>
9 AROS_LH1(struct Task
*, FindTaskByPID
,
12 AROS_LHA(ULONG
, id
, D0
),
15 struct ExecBase
*, SysBase
, 166, Exec
)
18 Scan through the task lists searching for the task whose
19 et_UniqueID field matches.
22 id - The task ID to match.
25 Address of the Task control structure that matches, or
29 This function is source-compatible with MorphOS.
39 ******************************************************************************/
47 First up, check ThisTask. It could be NULL because of exec_init.c
49 if (SysBase
->ThisTask
!= NULL
)
51 et
= GetETask(SysBase
->ThisTask
);
52 if (et
!= NULL
&& et
->et_UniqueID
== id
)
53 return SysBase
->ThisTask
;
56 /* Next, go through the ready list */
57 ForeachNode(&SysBase
->TaskReady
, t
)
60 if (et
!= NULL
&& et
->et_UniqueID
== id
)
64 /* Finally, go through the wait list */
65 ForeachNode(&SysBase
->TaskWait
, t
)
68 if (et
!= NULL
&& et
->et_UniqueID
== id
)