2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
5 Desc: Permit() - Allow tasks switches to occur.
9 #include <exec/types.h>
10 #include <exec/execbase.h>
11 #include <aros/libcall.h>
12 #include <aros/atomic.h>
13 #include <proto/exec.h>
15 /*****************************************************************************/
23 AROS_LH0(void, Permit
,
26 struct ExecBase
*, SysBase
, 23, Exec
)
29 This function will reactivate the task dispatcher after a call
30 to Forbid(). Note that calls to Forbid() nest, and for every
31 call to Forbid() you need a matching call to Permit().
37 Multitasking will be re-enabled.
40 This function preserves all registers.
42 To prevent deadlocks calling Wait() in forbidden state breaks
43 the forbid - thus taskswitches may happen again.
46 No you really don't want to use this function.
49 The only architecture that you can rely on the registers being
50 saved is on the Motorola mc68000 family.
53 Forbid(), Disable(), Enable(), Wait()
56 If you want to preserve all the registers, replace this function
57 in your $(KERNEL) directory. Otherwise this function is
60 ******************************************************************************/
67 Task switches are allowed again, if a switch is pending, we
71 AROS_ATOMIC_DEC(SysBase
->TDNestCnt
);
73 AROS_ATOMIC_DEC(SysBase
->TDNestCnt
);
75 if( ( SysBase
->TDNestCnt
< 0 )
76 && ( SysBase
->IDNestCnt
< 0 )
77 && ( SysBase
->AttnResched
& 0x80 ) )
79 /* Haha, you re-enabled multitasking, only to have the rug
80 pulled out from under you feet :)
82 Clear the Switch() pending flag.
86 SysBase
->AttnResched
&= ~0x80;