2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
5 Desc: Switch() - Switch to the next available task.
9 #include <exec/execbase.h>
11 /*****************************************************************************
14 #include <proto/exec.h>
16 AROS_LH0(void, Switch
,
19 struct ExecBase
*, SysBase
, 9, Exec
)
22 Switch to the next task which wishes to be run. This function has
23 a similar effect to calling Dispatch(), however it may be called
24 at any time, and will not lose the current task if it is of type
32 This function will preserve all its registers.
39 Dispatch(), Reschedule()
42 If you want to have this function save all its registers, you
43 should replace this function in $(KERNEL) or $(ARCH).
45 ******************************************************************************/
49 struct Task
*this = SysBase
->ThisTask
;
52 If the state is not TS_RUN then the task is already in a list
56 This task (= the task that's running in the moment) is
57 moved to the task ready list with Reschedule(), if necessary.
58 After that a new task is taken from the task-ready list
59 and is launched by doing the context switch. This happens
64 if( (this->tc_State
== TS_RUN
)
65 && !(this->tc_Flags
& TF_EXCEPT
) )
67 this->tc_State
= TS_READY
;
69 /* Use Reschedule() to put the task in the correct list. */
73 /* Call the dispatcher proper. */