Minor fixes to comments.
[AROS.git] / rom / exec / forbid.c
blob4c221adad7c49b5d438c9a1d6aa2ead9e0295eea
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Forbid() - Prevent tasks switches from taking place.
6 Lang: english
7 */
9 #include <exec/types.h>
10 #include <exec/execbase.h>
11 #include <aros/libcall.h>
12 #include <aros/atomic.h>
14 /*****************************************************************************/
15 #undef Exec
16 #ifdef UseExecstubs
17 # define Exec _Exec
18 #endif
20 /* NAME */
21 #include <proto/exec.h>
23 AROS_LH0(void, Forbid,
25 /* LOCATION */
26 struct ExecBase *, SysBase, 22, Exec)
28 /* FUNCTION
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().
41 INPUTS
42 None.
44 RESULT
45 The multitasking state will be disabled AFTER this function
46 returns to the caller.
48 NOTES
49 This function preserves all registers.
51 To prevent deadlocks calling Wait() in forbidden state breaks
52 the forbid - thus taskswitches may happen again.
54 EXAMPLE
55 No you really don't want to use this function.
57 BUGS
58 The only architecture that you can rely on the registers being
59 saved is on the Motorola mc68000 family.
61 SEE ALSO
62 Permit(), Disable(), Enable(), Wait()
64 INTERNALS
65 If you want to preserve all the registers, replace this function
66 in your $(KERNEL) directory. Otherwise this function is
67 satisfactory.
69 ******************************************************************************/
71 #undef Exec
73 AROS_LIBFUNC_INIT
75 AROS_ATOMIC_INC(SysBase->TDNestCnt);
77 AROS_LIBFUNC_EXIT
78 } /* Forbid() */