2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
5 Desc: Forbid() - Prevent tasks switches from taking place.
9 #include <exec/types.h>
10 #include <exec/execbase.h>
11 #include <aros/libcall.h>
12 #include <aros/atomic.h>
14 /*****************************************************************************/
21 #include <proto/exec.h>
23 AROS_LH0(void, Forbid
,
26 struct ExecBase
*, SysBase
, 22, Exec
)
29 Forbid any further taskswitches until a matching call to Permit().
30 Naturally disabling taskswitches means:
32 THIS CALL IS DANGEROUS
34 Do not use it without thinking very well about it or better
35 do not use it at all. Most of the time you can live without
36 it by using semaphores or similar.
38 Calls to Forbid() nest, i.e. for each call to Forbid() you
39 need one call to Permit().
45 The multitasking state will be disabled AFTER this function
46 returns to the caller.
49 This function preserves all registers.
51 To prevent deadlocks calling Wait() in forbidden state breaks
52 the forbid - thus taskswitches may happen again.
55 No you really don't want to use this function.
58 The only architecture that you can rely on the registers being
59 saved is on the Motorola mc68000 family.
62 Permit(), Disable(), Enable(), Wait()
65 If you want to preserve all the registers, replace this function
66 in your $(KERNEL) directory. Otherwise this function is
69 ******************************************************************************/
75 AROS_ATOMIC_INC(SysBase
->TDNestCnt
);