diff options
Diffstat (limited to 'src/w32xfns.c')
-rw-r--r-- | src/w32xfns.c | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/src/w32xfns.c b/src/w32xfns.c index 018dd14cb80..cb452571665 100644 --- a/src/w32xfns.c +++ b/src/w32xfns.c @@ -19,6 +19,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> #include <signal.h> #include <stdio.h> + #include "lisp.h" #include "keyboard.h" #include "frame.h" @@ -32,7 +33,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #define myfree(lp) GlobalFreePtr (lp) CRITICAL_SECTION critsect; + +#ifdef WINDOWSNT extern HANDLE keyboard_handle; +#endif /* WINDOWSNT */ + HANDLE input_available = NULL; HANDLE interrupt_handle = NULL; @@ -43,7 +48,11 @@ init_crit (void) /* 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); + input_available = CreateEvent (NULL, TRUE, FALSE, NULL); + +#ifdef WINDOWSNT + keyboard_handle = input_available; +#endif /* WINDOWSNT */ /* interrupt_handle is signaled when quit (C-g) is detected, so that blocking system calls can be interrupted. We make it a manual @@ -240,6 +249,22 @@ get_next_msg (W32Msg * lpmsg, BOOL bWait) return (bRet); } +extern char * w32_strerror (int error_no); + +/* Tell the main thread that we have input available; if the main + thread is blocked in select(), we wake it up here. */ +static void +notify_msg_ready (void) +{ + SetEvent (input_available); + +#ifdef CYGWIN + /* Wakes up the main thread, which is blocked select()ing for /dev/windows, + among other files. */ + (void) PostThreadMessage (dwMainThreadId, WM_EMACS_INPUT_READY, 0, 0); +#endif /* CYGWIN */ +} + BOOL post_msg (W32Msg * lpmsg) { @@ -263,8 +288,7 @@ post_msg (W32Msg * lpmsg) } lpTail = lpNew; - SetEvent (input_available); - + notify_msg_ready (); leave_crit (); return (TRUE); @@ -285,7 +309,7 @@ prepend_msg (W32Msg *lpmsg) nQueue++; lpNew->lpNext = lpHead; lpHead = lpNew; - + notify_msg_ready (); leave_crit (); return (TRUE); |