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

From: Eli Zaretskii <[email-masked]>
Date: Thu, 05 Oct 2017 10:24:11 +0300

> Date: Thu, 05 Oct 2017 12:27:28 +0900
> From: YAMAMOTO Mitsuharu <[email-masked]>
> Cc: [email-masked],
> 	[email-masked],
> 	[email-masked]
> 
> >>>>> On Wed, 04 Oct 2017 12:23:19 +0300, Eli Zaretskii <[email-masked]> said:
> 
> >> > OOC, could you please see whether on X the sit-for call is
> >> > interrupted or not?  That is, do you see the "there" message
> >> > after typing C-g?
> Same for NS.  Interestingly, some variants of the original recipe
> behave differently with respect to C-g depending on the toolkit.
> 
> Example 1:
> 
> (thread-join
>  (make-thread
>   (lambda ()
>     (message "hello")
>     (sit-for 2)
>     (message "there"))))
> 
> Interrupted: GTK+, Athena, no toolkit, Mac
> Not interrupted: NS
> 
> 
> Example 2:
> 
> (thread-join
>  (make-thread
>   (lambda ()
>     (message "hello")
>     (sleep-for 2)
>     (message "there"))))
> 
> Interrupted: GTK+
> Not interrupted: Athena, no toolkit, Mac, NS

For the record, on MS-Windows, both are interrupted.

> Probably it has something to do with xg_select.

Could be.

The upshot of this is that doing keyboard I/O in non-main threads is
inherently unportable.  Should we mention this in the manual?