Subject: bug#79228: 30.1.90; native--compile-async sentinel can error if threads are running

From: Spencer Baugh <[email-masked]>
Date: Mon, 01 Sep 2025 15:10:59 -0400

Eli Zaretskii <[email-masked]> writes:

>> From: Spencer Baugh <[email-masked]>
>> Cc: [email-masked],  [email-masked],  [email-masked]
>> Date: Mon, 01 Sep 2025 12:03:21 -0400
>> 
>> Eli Zaretskii <[email-masked]> writes:
>> 
>> >> 1. emacs -Q
>> >> 2. Run some command which starts a thread
>> >> 3. Run some command which starts native compilation
>> >> 
>> >> Native compilation is done via pending_funcalls.  pending_funcalls can
>> >> be run in the non-main thread started by 2.
>> >
>> > How?
>> 
>> Because pending_funcalls is run by timer_check_2, which is run by
>> timer_check, which is run by wait_reading_process_output, which can be
>> run by non-main threads.
>
> So maybe we should run timers only in the main thread?

That would break, for example, with-timeout.

Alternatively, if we stopped locking processes to threads, this problem
would also be fixed.