2 Copyright © 1995-2015, The AROS Development Team. All rights reserved.
5 Desc: Permit() - Allow tasks switches to occur.
11 #include <exec/types.h>
12 #include <exec/execbase.h>
13 #include <aros/libcall.h>
14 #include <aros/atomic.h>
15 #include <aros/debug.h>
16 #include <proto/exec.h>
17 #include <proto/kernel.h>
19 #include "exec_intern.h"
26 /*****************************************************************************
30 AROS_LH0(void, Permit
,
33 struct ExecBase
*, SysBase
, 23, Exec
)
36 This function will reactivate the task dispatcher after a call
37 to Forbid(). Note that calls to Forbid() nest, and for every
38 call to Forbid() you need a matching call to Permit().
44 Multitasking will be re-enabled.
47 This function preserves all registers.
49 To prevent deadlocks calling Wait() in forbidden state breaks
50 the forbid - thus taskswitches may happen again.
53 No you really don't want to use this function.
56 The only architecture that you can rely on the registers being
57 saved is on the Motorola mc68000 family.
60 Forbid(), Disable(), Enable(), Wait()
63 If you want to preserve all the registers, replace this function
64 in your $(KERNEL) directory. Otherwise this function is
70 ******************************************************************************/
75 D(bug("[Exec] Permit()\n"));
78 * Task switches are allowed again, if a switch is pending, we
83 D(bug("[Exec] Permit: TDNESTCOUNT = %d\n", TDNESTCOUNT_GET
));
85 if (KernelBase
&& !KrnIsSuper())
87 if( ( TDNESTCOUNT_GET
< 0 )
88 && ( IDNESTCOUNT_GET
< 0 )
89 && ( FLAG_SCHEDSWITCH_ISSET
) )
92 * Haha, you re-enabled multitasking, only to have the rug
93 * pulled out from under you feet :)
95 * Clear the Switch() pending flag.
97 D(bug("[Exec] Permit: rescheduling\n"));