From 835ee136c54348a61f5b5d2ef34de05e5c3476ed Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sun, 6 Mar 2005 15:59:44 +0000 Subject: [PATCH] (UNBLOCK_INPUT_TO): New macro. (TOTALLY_UNBLOCK_INPUT): Handle a pending signal if any. --- src/blockinput.h | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/blockinput.h b/src/blockinput.h index a4c8a9b9c22..a3b50d2a0f2 100644 --- a/src/blockinput.h +++ b/src/blockinput.h @@ -94,7 +94,30 @@ extern int pending_atimers; } \ while (0) -#define TOTALLY_UNBLOCK_INPUT (interrupt_input_blocked = 0) +/* Undo any number of BLOCK_INPUT calls, + and also reinvoke any pending signal. */ + +#define TOTALLY_UNBLOCK_INPUT \ + if (interrupt_input_blocked != 0) \ + { \ + interrupt_input_blocked = 1; \ + UNBLOCK_INPUT; \ + } \ + else + +/* Undo any number of BLOCK_INPUT calls down to level LEVEL, + and also (if the level is now 0) reinvoke any pending signal. */ + +#define UNBLOCK_INPUT_TO(LEVEL) \ + do \ + { \ + int oldlevel = interrupt_input_blocked; \ + interrupt_input_blocked = (LEVEL) + 1; \ + if (interrupt_input_blocked != oldlevel + 1) \ + UNBLOCK_INPUT; \ + } \ + while (0) + #define UNBLOCK_INPUT_RESIGNAL UNBLOCK_INPUT /* In critical section ? */ -- 2.39.2