Subject: bug#50043: 28.0.50; USABLE_SIGOI undef code paths do not work correctly

From: Ken Brown <[email-masked]>
Date: Wed, 17 Nov 2021 09:19:27 -0500

On 11/17/2021 8:14 AM, Eli Zaretskii wrote:
>> Date: Tue, 16 Nov 2021 18:06:51 -0500
>> Cc: [email-masked], [email-masked]
>> From: Ken Brown <[email-masked]>
>>
>> Are you talking about having x_get_foreign_selection call
>> wait_reading_process_output in a loop?
> 
> Yes.
> 
>> That would fix this particular bug, but I was thinking of trying to
>> solve a more general problem.
> 
> What is that more general problem, and when does it rear its ugly
> head?

The problem is that whenever wait_reading_process_output needs to repeatedly 
check for input (i.e., read_kbd || !NILP (wait_for_cell) == true), it can get 
stuck in select for up to 2 seconds on systems without USABLE_SIGIO.  (2 arises 
here because it's the default value of polling-period.)

I don't know offhand when it rears its ugly head aside from the X selection case 
we're discussing.  We would only know about it if someone notices an unexpected 
delay, finds a recipe for reproducing it, and reports it as a bug, as happened 
here with bug#29170, which is what led to the present bug report.  And look how 
long it took before the cause of that delay was discovered.

So I think it's better to fix the general (potential) problem, not just the X 
selection case.

Ken