revert between 56095 -> 55830 in arch
[AROS.git] / rom / exec / reschedule.c
blob3575f81bf05843dfa16918cf7b2650f4dcb2d688
1 /*
2 Copyright © 1995-2017, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Enforce task rescheduling
6 Lang: english
7 */
9 #define DEBUG 0
11 #include <exec/execbase.h>
12 #include <aros/libcall.h>
13 #include <aros/atomic.h>
14 #include <hardware/intbits.h>
16 #include "chipset.h"
17 #include "exec_intern.h"
19 /*****************************************************************************
21 NAME */
22 #include <proto/exec.h>
24 AROS_LH0(void, Reschedule,
26 /* SYNOPSIS */
28 /* LOCATION */
29 struct ExecBase *, SysBase, 8, Exec)
31 /* FUNCTION
32 Give up the CPU time to other tasks (if there are any).
34 INPUTS
35 None
37 RESULT
38 None
40 NOTES
41 This function was private in AmigaOS(tm) up to v3.1. There's no guarantee
42 that it will continue to exist in other systems.
44 EXAMPLE
46 BUGS
48 SEE ALSO
50 INTERNALS
52 HISTORY
54 ******************************************************************************/
56 AROS_LIBFUNC_INIT
58 BOOL switchpending = FLAG_SCHEDSWITCH_ISSET;
60 FLAG_SCHEDSWITCH_SET; /* Set scheduling attention */
62 if (TDNESTCOUNT_GET < 0) /* If task switching enabled */
64 if (IDNESTCOUNT_GET < 0) /* And interrupts enabled */
66 D(bug("[Reschedule] Calling scheduler, KernelBase 0x%p\n", KernelBase);)
67 KrnSchedule(); /* Call scheduler */
69 else if (!switchpending)
72 * Interrupts are disabled and there was no pending switch before us.
73 * Tag the software interrupt to be executed immediately after Enable().
75 CUSTOM_CAUSE(INTF_SOFTINT);
79 AROS_LIBFUNC_EXIT
80 } /* Reschedule */