diff --git a/src/nsterm.m b/src/nsterm.m index f094b145fe3..075d1af0938 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -4739,12 +4739,13 @@ Function modeled after x_draw_glyph_string_box (). check_native_fs (); #endif - if (hold_event_q.nr > 0 && !run_loop_only) + /* If there are input events pending, store them so that + Emacs can recognize C-g. */ + if (hold_event_q.nr > 0) { - /* We already have events pending. */ - raise (SIGIO); - errno = EINTR; - return -1; + for (int i = 0; i < hold_event_q.nr; ++i) + kbd_buffer_store_event_hold (&hold_event_q.q[i], NULL); + hold_event_q.nr = 0; } eassert (nfds <= FD_SETSIZE); @@ -4757,7 +4758,7 @@ Function modeled after x_draw_glyph_string_box (). if (NSApp == nil || ![NSThread isMainThread] || (timeout && timeout->tv_sec == 0 && timeout->tv_nsec == 0)) - return thread_select (pselect, nfds, readfds, writefds, + thread_select (pselect, nfds, readfds, writefds, exceptfds, timeout, sigmask); else {