* lisp/textmodes/table.el (table-insert): Don't use `symbol-name' on
[emacs.git] / src / blockinput.h
blob70822e29be7bc3fc1e59ad29b4528fbf80a9ff05
1 /* blockinput.h - interface to blocking complicated interrupt-driven input.
2 Copyright (C) 1989, 1993, 2001-2012 Free Software Foundation, Inc.
4 This file is part of GNU Emacs.
6 GNU Emacs is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 GNU Emacs is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 #ifndef EMACS_BLOCKINPUT_H
20 #define EMACS_BLOCKINPUT_H
22 INLINE_HEADER_BEGIN
23 #ifndef BLOCKINPUT_INLINE
24 # define BLOCKINPUT_INLINE INLINE
25 #endif
27 /* Emacs should avoid doing anything hairy in a signal handler, because
28 so many system functions are non-reentrant. For example, malloc
29 and the Xlib functions aren't usually re-entrant, so if they were
30 used by the SIGIO handler, we'd lose.
32 To avoid this, we make the following requirements:
34 * Everyone must evaluate BLOCK_INPUT before performing actions that
35 might conflict with a signal handler, and then call UNBLOCK_INPUT
36 after performing them. Calls BLOCK_INPUT and UNBLOCK_INPUT may be
37 nested.
39 * Any complicated interrupt handling code should test
40 INPUT_BLOCKED_P, and put off its work until later.
42 * If the interrupt handling code wishes, it may set
43 pending_signals to a non-zero value. If that flag is set
44 when input becomes unblocked, UNBLOCK_INPUT will then read
45 input and process timers.
47 Historically, Emacs signal handlers did much more than they do now,
48 and this caused many BLOCK_INPUT calls to be sprinkled around the code.
49 FIXME: Remove calls that aren't needed now. */
51 extern volatile int interrupt_input_blocked;
53 /* Begin critical section. */
55 BLOCKINPUT_INLINE void
56 block_input (void)
58 interrupt_input_blocked++;
61 extern void unblock_input (void);
62 extern void totally_unblock_input (void);
63 extern void unblock_input_to (int);
65 /* In critical section ? */
67 BLOCKINPUT_INLINE bool
68 input_blocked_p (void)
70 return 0 < interrupt_input_blocked;
73 INLINE_HEADER_END
75 #endif /* EMACS_BLOCKINPUT_H */