summaryrefslogtreecommitdiff
path: root/src/w32xfns.c
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1998-05-15 20:53:39 +0000
committerRichard M. Stallman <rms@gnu.org>1998-05-15 20:53:39 +0000
commit1ce3dc2b2d069683aae490efa44da83f48df168d (patch)
tree801da72ce1c0b3db730f806011a5e8924a130845 /src/w32xfns.c
parent85348a1744b43cd3a800ac1bed2f2e4b0d30b6f7 (diff)
downloademacs-1ce3dc2b2d069683aae490efa44da83f48df168d.tar.gz
(interrupt_handle): New variable.
(init_crit): Initialize it. (delete_crit): Cleanup on exit. (signal_quit): New function. Signal any threads that are blocked on a "system" call (provided they have been specially written to check for this), so the call can fail with EINTR as on Unix.
Diffstat (limited to 'src/w32xfns.c')
-rw-r--r--src/w32xfns.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/w32xfns.c b/src/w32xfns.c
index 5436ff2e81a..c2b1d705c9a 100644
--- a/src/w32xfns.c
+++ b/src/w32xfns.c
@@ -33,6 +33,7 @@ Boston, MA 02111-1307, USA. */
CRITICAL_SECTION critsect;
extern HANDLE keyboard_handle;
HANDLE input_available = NULL;
+HANDLE interrupt_handle = NULL;
void
init_crit ()
@@ -42,6 +43,14 @@ init_crit ()
/* For safety, input_available should only be reset by get_next_msg
when the input queue is empty, so make it a manual reset event. */
keyboard_handle = input_available = CreateEvent (NULL, TRUE, FALSE, NULL);
+
+ /* interrupt_handle is signalled when quit (C-g) is detected, so that
+ blocking system calls can be interrupted. We make it a manual
+ reset event, so that if we should ever have multiple threads
+ performing system calls, they will all be interrupted (I'm guessing
+ that would the right response). Note that we use PulseEvent to
+ signal this event, so that it never remains signalled. */
+ interrupt_handle = CreateEvent (NULL, TRUE, FALSE, NULL);
}
void
@@ -54,6 +63,19 @@ delete_crit ()
CloseHandle (input_available);
input_available = NULL;
}
+ if (interrupt_handle)
+ {
+ CloseHandle (interrupt_handle);
+ interrupt_handle = NULL;
+ }
+}
+
+void
+signal_quit ()
+{
+ /* Make sure this event never remains signalled; if the main thread
+ isn't in a blocking call, then this should do nothing. */
+ PulseEvent (interrupt_handle);
}
void