Updated PCI IDs to latest snapshot.
[tangerine.git] / rom / exec / switch.c
blobe89cb48c3bb300dc3f4ab74a39383fb25a9a97ab
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Switch() - Switch to the next available task.
6 Lang: english
7 */
9 #include <exec/execbase.h>
11 /*****************************************************************************
13 NAME */
14 #include <proto/exec.h>
16 AROS_LH0(void, Switch,
18 /* LOCATION */
19 struct ExecBase *, SysBase, 9, Exec)
21 /* FUNCTION
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
25 TS_RUN.
27 INPUTS
29 RESULT
31 NOTES
32 This function will preserve all its registers.
34 EXAMPLE
36 BUGS
38 SEE ALSO
39 Dispatch(), Reschedule()
41 INTERNALS
42 If you want to have this function save all its registers, you
43 should replace this function in $(KERNEL) or $(ARCH).
45 ******************************************************************************/
47 AROS_LIBFUNC_INIT
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
60 in Dispatch().
62 return;
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. */
70 Reschedule(this);
73 /* Call the dispatcher proper. */
74 Dispatch();
76 AROS_LIBFUNC_EXIT
77 } /* Switch() */