From: "Gerd Möllmann" <gerd.moellmann@gmail.com>
To: 69561@debbugs.gnu.org
Cc: Alan Third <alan@idiocy.org>
Subject: bug#69561: 30.0.50; Freeze from M-x gnus on macOS
Date: Thu, 07 Mar 2024 16:52:27 +0100 [thread overview]
Message-ID: <m2bk7qkpj8.fsf@Pro.fritz.box> (raw)
In-Reply-To: <m2ttlijck7.fsf@Pro.fritz.box> ("Gerd Möllmann"'s message of "Thu, 07 Mar 2024 16:18:00 +0100")
Gerd Möllmann <gerd.moellmann@gmail.com> writes:
> (CC'd to Alan.)
>
> As a reminder, the freezes are especially annoying because one cannot
> C-g out of them. I read the NS code today, and I think I at least have a
> strong suspicion why that is.
>
> Let's just simplify things and say that the NS code has a queue named
> hold_events_q of struct input_event (global variable). The queue is
> filled when EmacsView receives NS events from the system, for example
> C-g. NS events are processed by calling [NSApp run] with some
> ornamention around it to make sure the calls returns. ns_select and
> ns_read_socket do that.
>
> The input_events in hold_events_q are given to Emacs in ns_read_socket,
> which is installed for terminal type as read_socket_hook. That's how
> normally a C-g is recognized by kdb_store_event and Vquit_flag is set.
>
> But hold_events_q are _not_ kbd_store'd in ns_select. Instead we have
>
> if (hold_event_q.nr > 0 && !run_loop_only)
> {
> /* We already have events pending. */
> raise (SIGIO);
> errno = EINTR;
> return -1;
> }
>
> So, ns_select returns -1 to wait_reading_process_out which loops,
> AFAICT.
>
> if (nfds < 0)
> {
> if (xerrno == EINTR)
> no_avail = 1;
> ...
> if (no_avail || nfds == 0)
> continue;
>
> And Vquit_flag is never changing because the C-g is still in
> hold_events_q, and maybe_quit does nothing.
>
> Does that make sense?
I'm now using the below change. This should also lead to NS events being
processed.
1 file changed, 6 insertions(+), 5 deletions(-)
src/nsterm.m | 11 ++++++-----
modified 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);
next prev parent reply other threads:[~2024-03-07 15:52 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-05 10:59 bug#69561: 30.0.50; Freeze from M-x gnus on macOS Gerd Möllmann
2024-03-05 11:04 ` Gerd Möllmann
2024-03-05 14:29 ` Gerd Möllmann
2024-03-05 15:46 ` Eli Zaretskii
2024-03-05 16:38 ` Gerd Möllmann
2024-03-05 16:52 ` Eli Zaretskii
2024-03-05 17:54 ` Gerd Möllmann
2024-03-07 15:18 ` Gerd Möllmann
2024-03-07 15:52 ` Gerd Möllmann [this message]
2024-03-07 16:05 ` Alan Third
2024-03-07 16:30 ` Gerd Möllmann
2024-03-07 16:49 ` Alan Third
2024-03-07 17:01 ` Gerd Möllmann
2024-03-07 18:47 ` Alan Third
2024-03-07 19:29 ` Gerd Möllmann
2024-03-07 20:23 ` Gerd Möllmann
2024-03-08 4:31 ` Gerd Möllmann
2024-03-09 7:33 ` Eli Zaretskii
2024-03-09 9:47 ` Gerd Möllmann
2024-03-09 10:07 ` Eli Zaretskii
2024-03-09 11:00 ` Gerd Möllmann
2024-03-09 11:11 ` Eli Zaretskii
2024-03-09 11:33 ` Gerd Möllmann
2024-03-09 13:08 ` Eli Zaretskii
2024-03-09 13:21 ` Gerd Möllmann
2024-03-09 13:27 ` Eli Zaretskii
2024-03-09 13:51 ` Gerd Möllmann
2024-03-13 6:11 ` Gerd Möllmann
2024-03-13 16:53 ` Filipp Gunbin
2024-03-13 18:18 ` Gerd Möllmann
2024-03-13 18:20 ` Gerd Möllmann
2024-03-13 19:20 ` Filipp Gunbin
2024-03-13 19:37 ` Gerd Möllmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2bk7qkpj8.fsf@Pro.fritz.box \
--to=gerd.moellmann@gmail.com \
--cc=69561@debbugs.gnu.org \
--cc=alan@idiocy.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.