2 Copyright © 1995-2013, 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 UWORD oldAttnSwitch
= SysBase
->AttnResched
& ARF_AttnSwitch
;
59 AROS_ATOMIC_OR(SysBase
->AttnResched
, ARF_AttnSwitch
); /* Set scheduling attention */
61 if (SysBase
->TDNestCnt
< 0) /* If task switching enabled */
63 if (SysBase
->IDNestCnt
< 0) /* And interrupts enabled */
65 D(bug("[Reschedule] Calling scheduler, KernelBase 0x%p\n", KernelBase
));
66 KrnSchedule(); /* Call scheduler */
68 else if (!oldAttnSwitch
)
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
);