From: "Gerd Möllmann" <gerd.moellmann@gmail.com>
To: Po Lu <luangruo@yahoo.com>
Cc: emacs-devel@gnu.org, "Gerd Möllmann" <gerd@gnu.org>
Subject: Re: master 4ac4cec652f: Prevent freezes on macOS (bug#69561)
Date: Wed, 13 Mar 2024 09:48:28 +0100 [thread overview]
Message-ID: <m2il1qldpf.fsf@Pro.fritz.box> (raw)
In-Reply-To: <87wmq6vam3.fsf@yahoo.com> (Po Lu's message of "Wed, 13 Mar 2024 15:45:08 +0800")
Po Lu <luangruo@yahoo.com> writes:
> Gerd Moellmann <gerd@gnu.org> writes:
>
>> if (NSApp == nil
>> || ![NSThread isMainThread]
>> || (timeout && timeout->tv_sec == 0 && timeout->tv_nsec == 0))
>> - return thread_select (pselect, nfds, readfds, writefds,
>> - exceptfds, timeout, sigmask);
>> + thread_select (pselect, nfds, readfds, writefds,
>> + exceptfds, timeout, sigmask);
>
> Far be it from me to offer advice on code I know very little about, but
> on the surface this appears to force non-main threads to enter [NSApp
> run] whenever they enter select. Is this really the desired behavior?
>
> I should think that this function, being provided by the toolkit for the
> purpose of running its event loop, must be called by strictly one thread
> at a time.
Well, let me first make the usual disclaimer that I don't know much
about about Cocoa. (And don't really want to, I must admit ;-)).
I couldn't find much advice which I'd call definite on using Cocoa from
multiple threads, except
https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/Multithreading/ThreadSafetySummary/ThreadSafetySummary.html#:~:text=Guidelines%20for%20using%20Cocoa%20from,are%20generally%20not%20thread%2Dsafe.
I interpret this as meaning that it's possible to do this, considering
that Emacs' threads run one at a time only, AFAIU. If that's no longer
the case, we have a problem, I agree.
next prev parent reply other threads:[~2024-03-13 8:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <171031025289.32157.8913441761015064536@vcs2.savannah.gnu.org>
[not found] ` <20240313061054.71155C1FB4A@vcs2.savannah.gnu.org>
2024-03-13 7:45 ` master 4ac4cec652f: Prevent freezes on macOS (bug#69561) Po Lu
2024-03-13 8:48 ` Gerd Möllmann [this message]
2024-03-13 11:07 ` Po Lu
2024-03-13 11:59 ` 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=m2il1qldpf.fsf@Pro.fritz.box \
--to=gerd.moellmann@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=gerd@gnu.org \
--cc=luangruo@yahoo.com \
/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.