Subject: Re: bug#78946: 30.1; accept-process-output not allowed in threads on macOS

From: Robert Pluim <[email-masked]>
Date: Thu, 03 Jul 2025 14:39:04 +0200

>>>>> On Thu, 03 Jul 2025 13:12:32 +0300, Eli Zaretskii <[email-masked]> said:

    >> #+begin_example
    >> 2025-07-02 12:10:23.857272-0700 Emacs[34130:54192679] [General]
    >> nextEventMatchingMask should only be called from the Main Thread!

    Eli> This message seems to be relevant, no?  Can some macOS expert explain
    Eli> what it means, and how is that related to ns_select?

On macOS only the main thread is allowed to process events, which is
why ns_select normally does a whole dance with a separate thread which
posts events for the main thread to react to. Itʼs fragile, and should
probably be re-written, but nobody has stepped up to do it.

John, does it help if you stick something like

  if ([[NSThread currentThread] isMainThread])
    {
    }

around the

    [NSApp run];

in `ns_select_1'?

Robert
--