Wanderer/Info: fix compilation
[AROS.git] / arch / .unmaintained / m68k-emul / disable.c
blobefd879fcd70ac72796ea873e5b2bc6d950971541
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Exec function Disable
6 Lang: english
7 */
9 #include <exec/execbase.h>
10 #include <signal.h>
12 void _os_disable (void);
14 /******************************************************************************
16 NAME
17 #include <proto/exec.h>
19 AROS_LH0(void, Disable,
21 LOCATION
22 struct ExecBase *, SysBase, 20, Exec)
24 FUNCTION
25 This function disables the delivery of all interrupts until a
26 matching call to Enable() is done. This implies a Forbid(). Since
27 the system needs the regular delivery of all interrupts it is
28 forbidden to disable them for longer than ~250 microseconds.
30 THIS CALL IS VERY DANGEROUS!!!
32 Do not use it without thinking very well about it or better do not
33 use it at all. Most of the time you can live without it by using
34 semaphores or similar.
36 Calls to Disable() nest, i.e. for each call to Disable() you need
37 one call to Enable().
39 INPUTS
40 None.
42 RESULT
43 None.
45 NOTES
46 This function preserves all registers.
48 This function may be used from interrupts to disable all higher
49 priority interrupts. Lower priority interrupts are disabled anyway.
51 To prevent deadlocks calling Wait() in disabled state breaks the
52 disable - thus interrupts and taskswitches may happen again.
54 EXAMPLE
56 BUGS
58 SEE ALSO
59 Forbid(), Permit(), Enable(), Wait()
61 INTERNALS
63 HISTORY
65 ******************************************************************************/
67 /* The real function is written in assembler as stub which calls me */
68 void _Disable (struct ExecBase * SysBase)
70 _os_disable ();
72 SysBase->IDNestCnt ++;
73 } /* _Disable */
75 /* The real function is written in assembler as stub which calls me */
76 void _os_disable (void)
78 sigset_t set;
80 sigfillset (&set);
82 sigprocmask (SIG_BLOCK, &set, NULL);
83 } /* disable */