2 Copyright © 1995-2015, The AROS Development Team. All rights reserved.
5 Desc: Enforce task rescheduling
9 #include <exec/execbase.h>
10 #include <aros/libcall.h>
11 #include <aros/atomic.h>
12 #include <hardware/intbits.h>
13 #include <proto/kernel.h>
16 #include "exec_intern.h"
18 /*****************************************************************************
21 #include <proto/exec.h>
23 AROS_LH0(void, Reschedule
,
28 struct ExecBase
*, SysBase
, 8, Exec
)
31 Give up the CPU time to other tasks (if there are any).
40 This function was private in AmigaOS(tm) up to v3.1. There's no guarantee
41 that it will continue to exist in other systems.
53 ******************************************************************************/
57 BOOL switchpending
= FLAG_SCHEDSWITCH_ISSET
;
59 FLAG_SCHEDSWITCH_SET
; /* Set scheduling attention */
61 if (TDNESTCOUNT_GET
< 0) /* If task switching enabled */
63 if (IDNESTCOUNT_GET
< 0) /* And interrupts enabled */
65 D(bug("[Reschedule] Calling scheduler, KernelBase 0x%p\n", KernelBase
);)
66 KrnSchedule(); /* Call scheduler */
68 else if (!switchpending
)
71 * Interrupts are disabled and there was no pending switch before us.
72 * Tag the software interrupt to be executed immediately after Enable().
74 CUSTOM_CAUSE(INTF_SOFTINT
);