2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
5 Desc: Change the priority of a task.
9 #include <exec/execbase.h>
10 #include <aros/libcall.h>
11 #include <proto/exec.h>
13 /*****************************************************************************
17 AROS_LH2(BYTE
, SetTaskPri
,
20 AROS_LHA(struct Task
*, task
, A1
),
21 AROS_LHA(LONG
, priority
, D0
),
24 struct ExecBase
*, SysBase
, 50, Exec
)
27 Change the priority of a given task. As a general rule the higher
28 the priority the more CPU time a task gets. Useful values are within
32 task - Pointer to task structure.
33 priority - New priority of the task.
50 ******************************************************************************/
56 /* Always Disable() when doing something with task lists. */
60 old
=task
->tc_Node
.ln_Pri
;
63 task
->tc_Node
.ln_Pri
=priority
;
65 /* Check if the task is willing to run. */
66 if(task
->tc_State
!=TS_WAIT
)
68 /* If it is in the ready list remove and reinsert it. */
69 if(task
->tc_State
==TS_READY
)
71 Remove(&task
->tc_Node
);
72 Enqueue(&SysBase
->TaskReady
,&task
->tc_Node
);
76 I could check the task priorities here to determine if
77 the following is really necessary, but OTOH priority
78 changes are rare and the hassle isn't really worth it.
80 This should be reconsidered, because of Executive [ldp].