Massive patch for the first months work adding System FC to GHC #35
[ghc-hetmet.git] / rts / RtsSignals.h
1 /* -----------------------------------------------------------------------------
2  *
3  * (c) The GHC Team, 1998-2005
4  *
5  * Signal processing / handling.
6  *
7  * ---------------------------------------------------------------------------*/
8
9 #ifndef RTS_SIGNALS_H
10 #define RTS_SIGNALS_H
11
12 #if !defined(PAR) && !defined(mingw32_HOST_OS)
13
14 #include "posix/Signals.h"
15
16 #elif defined(mingw32_HOST_OS)
17
18 #include "win32/ConsoleHandler.h"
19
20 #else /* PAR */
21
22 #define signals_pending() (rtsFalse)
23
24 #endif /* PAR */
25
26
27 #if RTS_USER_SIGNALS
28
29 /*
30  * Function: initUserSignals()
31  *
32  * Initialize the console handling substrate.
33  */
34 extern void initUserSignals(void);
35
36 /*
37  * Function: initDefaultHandlers()
38  *
39  * Install any default signal/console handlers. Currently we install a
40  * Ctrl+C handler that shuts down the RTS in an orderly manner.
41  */
42 extern void initDefaultHandlers(void);
43
44 /*
45  * Function: blockUserSignals()
46  *
47  * Temporarily block the delivery of further console events. Needed to
48  * avoid race conditions when GCing the queue of outstanding handlers or
49  * when emptying the queue by running the handlers.
50  * 
51  */
52 extern void blockUserSignals(void);
53
54 /*
55  * Function: unblockUserSignals()
56  *
57  * The inverse of blockUserSignals(); re-enable the deliver of console events.
58  */
59 extern void unblockUserSignals(void);
60
61 /*
62  * Function: awaitUserSignals()
63  *
64  * Wait for the next console event. Currently a NOP (returns immediately.)
65  */
66 extern void awaitUserSignals(void);
67
68 /*
69  * Function: markSignalHandlers()
70  *
71  * Evacuate the handler queue. _Assumes_ that console event delivery
72  * has already been blocked.
73  */
74 extern void markSignalHandlers (evac_fn evac);
75
76 #endif /* RTS_USER_SIGNALS */
77
78 #endif /* RTS_SIGNALS_H */