2 Copyright © 1995-2017, The AROS Development Team. All rights reserved.
5 Desc: Enforce task rescheduling
11 #include <exec/execbase.h>
12 #include <aros/libcall.h>
13 #include <aros/atomic.h>
14 #include <hardware/intbits.h>
17 #include "exec_intern.h"
19 /*****************************************************************************
22 #include <proto/exec.h>
24 AROS_LH0(void, Reschedule
,
29 struct ExecBase
*, SysBase
, 8, Exec
)
32 Give up the CPU time to other tasks (if there are any).
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.
54 ******************************************************************************/
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
);