aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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. */
33CRITICAL_SECTION critsect; 33CRITICAL_SECTION critsect;
34extern HANDLE keyboard_handle; 34extern HANDLE keyboard_handle;
35HANDLE input_available = NULL; 35HANDLE input_available = NULL;
36HANDLE interrupt_handle = NULL;
36 37
37void 38void
38init_crit () 39init_crit ()
@@ -42,6 +43,14 @@ init_crit ()
42 /* For safety, input_available should only be reset by get_next_msg 43 /* For safety, input_available should only be reset by get_next_msg
43 when the input queue is empty, so make it a manual reset event. */ 44 when the input queue is empty, so make it a manual reset event. */
44 keyboard_handle = input_available = CreateEvent (NULL, TRUE, FALSE, NULL); 45 keyboard_handle = input_available = CreateEvent (NULL, TRUE, FALSE, NULL);
46
47 /* interrupt_handle is signalled when quit (C-g) is detected, so that
48 blocking system calls can be interrupted. We make it a manual
49 reset event, so that if we should ever have multiple threads
50 performing system calls, they will all be interrupted (I'm guessing
51 that would the right response). Note that we use PulseEvent to
52 signal this event, so that it never remains signalled. */
53 interrupt_handle = CreateEvent (NULL, TRUE, FALSE, NULL);
45} 54}
46 55
47void 56void
@@ -54,6 +63,19 @@ delete_crit ()
54 CloseHandle (input_available); 63 CloseHandle (input_available);
55 input_available = NULL; 64 input_available = NULL;
56 } 65 }
66 if (interrupt_handle)
67 {
68 CloseHandle (interrupt_handle);
69 interrupt_handle = NULL;
70 }
71}
72
73void
74signal_quit ()
75{
76 /* Make sure this event never remains signalled; if the main thread
77 isn't in a blocking call, then this should do nothing. */
78 PulseEvent (interrupt_handle);
57} 79}
58 80
59void 81void