2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
5 Desc: Search a task by name.
8 #include <exec/execbase.h>
9 #include <aros/libcall.h>
10 #include <proto/exec.h>
11 #include "exec_intern.h"
13 /*****************************************************************************
17 AROS_LH1(struct Task
*, FindTask
,
20 AROS_LHA(CONST_STRPTR
, name
, A1
),
23 struct ExecBase
*, SysBase
, 49, Exec
)
26 Find a task with a given name or get the address of the current task.
27 Finding the address of the current task is a very quick function
28 call, but finding a special task is a very CPU intensive instruction.
29 Note that generally a task may already be gone when this function
33 name - Pointer to name or NULL for current task.
36 Address of task structure found.
48 ******************************************************************************/
54 /* Quick return for a quick argument */
58 /* Always protect task lists with a Disable(). */
61 /* First look into the ready list. */
62 ret
=(struct Task
*)FindName(&SysBase
->TaskReady
,name
);
65 /* Then into the waiting list. */
66 ret
=(struct Task
*)FindName(&SysBase
->TaskWait
,name
);
70 Finally test the current task. Note that generally
71 you know the name of your own task - so it is close
72 to nonsense to look for it this way.
74 char *s1
=GET_THIS_TASK
->tc_Node
.ln_Name
;
77 /* Check as long as the names are identical. */
79 /* Terminator found? */
89 /* Return whatever I found. */