bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#28630: 27.0.50; C-g while a non-main thread is sitting crashes Emacs


From: Eli Zaretskii
Subject: bug#28630: 27.0.50; C-g while a non-main thread is sitting crashes Emacs
Date: Mon, 09 Oct 2017 11:38:33 +0300

> Date: Mon, 09 Oct 2017 17:21:59 +0900
> From: YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
> Cc: YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>, agrambot@gmail.com,
>  28630@debbugs.gnu.org, tom@tromey.com
> 
> > For the record, on MS-Windows, both are interrupted.
> 
> I could make the Mac port interruptible also for Example 2 (with some
> delay because it uses polling with SIGALRM rather than SIGIO).  I also
> confirmed that Motif behaved like Athena.  Below is updated one:

Thanks, more commonality in behavior is good, I think.

> In principle, the method I used for the Mac port is also applicable to
> X11 (but probably not for NS where secondary threads cannot read
> keyboard input).  Each pselect call not involving keyboard input
> additionally monitors one side of a socket pair, and the SIGALRM
> handler writes to the other side.  This way, a pselect call in a
> secondary thread is unblocked when the signal arrived, and then it
> tries to see if keyboard input is available when none of other threads
> is monitoring the keyboard input channel.

But the problematic part in these examples is that the main thread
always waits for keyboard input, because the non-main thread starts
running only when the main thread becomes idle, and becoming idle
means calling pselect.  And since the main thread is always the first
one to call pselect, it is the thread which finds the keyboard
descriptor unmonitored, and installs itself as its monitoring thread.

So with your proposal, more often than not, the "none of other threads
is monitoring the keyboard input channel" part will never be true,
except for the main thread.  Or am I missing something?

> Having said that, I don't think we need the change like this urgently.
> For now, we can see if the above method really works for more
> complicated situations using the Mac port.

I agree.  So far, I've only seen toy programs, and it isn't clear to
me how serious those problems are in real life.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]