# HG changeset patch # User Richard M. Stallman # Date 895265619 0 # Node ID ae5e3b23c7e2b990411c41619a6dbe4a5c2b2d4a # Parent 3313e702e44223a6417951d72b1cd0b4759a0a02 (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. diff -r 3313e702e442 -r ae5e3b23c7e2 src/w32xfns.c --- a/src/w32xfns.c Fri May 15 20:35:58 1998 +0000 +++ b/src/w32xfns.c Fri May 15 20:53:39 1998 +0000 @@ -33,6 +33,7 @@ CRITICAL_SECTION critsect; extern HANDLE keyboard_handle; HANDLE input_available = NULL; +HANDLE interrupt_handle = NULL; void init_crit () @@ -42,6 +43,14 @@ /* 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 @@ 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