tools/adflib: build only host variant which is used by Sam440 target
[AROS.git] / rom / exec / forbid.c
blob13c9cc70f5db1b909563799a56ec25e9af33939d
1 /*
2 Copyright © 1995-2015, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Forbid() - Prevent tasks switches from taking place.
6 Lang: english
7 */
9 #define DEBUG 0
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"
18 #undef Exec
19 #ifdef UseExecstubs
20 # define Exec _Exec
21 #endif
23 /*****************************************************************************/
26 /* NAME */
27 #include <proto/exec.h>
29 AROS_LH0(void, Forbid,
31 /* LOCATION */
32 struct ExecBase *, SysBase, 22, Exec)
34 /* FUNCTION
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().
47 INPUTS
48 None.
50 RESULT
51 The multitasking state will be disabled AFTER this function
52 returns to the caller.
54 NOTES
55 This function preserves all registers.
57 To prevent deadlocks calling Wait() in forbidden state breaks
58 the forbid - thus taskswitches may happen again.
60 EXAMPLE
61 No you really don't want to use this function.
63 BUGS
64 The only architecture that you can rely on the registers being
65 saved is on the Motorola mc68000 family.
67 SEE ALSO
68 Permit(), Disable(), Enable(), Wait()
70 INTERNALS
71 If you want to preserve all the registers, replace this function
72 in your $(KERNEL) directory. Otherwise this function is
73 satisfactory.
75 ******************************************************************************/
77 #undef Exec
79 AROS_LIBFUNC_INIT
81 D(bug("[Exec] Forbid()\n"));
83 TDNESTCOUNT_INC;
85 D(bug("[Exec] Forbid: TDNESTCOUNT = %d\n", TDNESTCOUNT_GET);)
87 AROS_LIBFUNC_EXIT
88 } /* Forbid() */