2 Copyright © 1995-2015, The AROS Development Team. All rights reserved.
5 Desc: Forbid() - Prevent tasks switches from taking place.
11 #include <exec/types.h>
12 #include <exec/execbase.h>
13 #include <aros/libcall.h>
14 #include <aros/atomic.h>
16 #include "exec_intern.h"
23 /*****************************************************************************/
27 #include <proto/exec.h>
29 AROS_LH0(void, Forbid
,
32 struct ExecBase
*, SysBase
, 22, Exec
)
35 Forbid any further taskswitches until a matching call to Permit().
36 Naturally disabling taskswitches means:
38 THIS CALL IS DANGEROUS
40 Do not use it without thinking very well about it or better
41 do not use it at all. Most of the time you can live without
42 it by using semaphores or similar.
44 Calls to Forbid() nest, i.e. for each call to Forbid() you
45 need one call to Permit().
51 The multitasking state will be disabled AFTER this function
52 returns to the caller.
55 This function preserves all registers.
57 To prevent deadlocks calling Wait() in forbidden state breaks
58 the forbid - thus taskswitches may happen again.
61 No you really don't want to use this function.
64 The only architecture that you can rely on the registers being
65 saved is on the Motorola mc68000 family.
68 Permit(), Disable(), Enable(), Wait()
71 If you want to preserve all the registers, replace this function
72 in your $(KERNEL) directory. Otherwise this function is
75 ******************************************************************************/
81 D(bug("[Exec] Forbid()\n"));
85 D(bug("[Exec] Forbid: TDNESTCOUNT = %d\n", TDNESTCOUNT_GET
);)