4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-02-08 10:09:32 +08:00

Cygwin: signal: Increase chance of handling signal in main thread

If the process() fails and the signal remains in the queue, the most
possible reason is that the target thread is already armed by another
signal and does not handle it yet. With this patch, to increase the
chance of handling it in the other threads, call yield() before
retrying process().

Addresses: https://cygwin.com/pipermail/cygwin/2024-November/256744.html
Fixes: e10f822a2b39 ("Cygwin: signal: Handle queued signal without explicit __SIGFLUSH")
Reported-by: Christian Franke <Christian.Franke@t-online.de>
Reviewed-by:
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
This commit is contained in:
Takashi Yano 2024-12-03 22:14:44 +09:00
parent 9a274a967d
commit c48d58d838

View File

@ -1325,7 +1325,10 @@ wait_sig (VOID *)
pack.si.si_signo = __SIGFLUSH;
else if (sigq.start.next
&& PeekNamedPipe (my_readsig, NULL, 0, NULL, &nb, NULL) && !nb)
pack.si.si_signo = __SIGFLUSH;
{
yield ();
pack.si.si_signo = __SIGFLUSH;
}
else if (!ReadFile (my_readsig, &pack, sizeof (pack), &nb, NULL))
Sleep (INFINITE); /* Assume were exiting. Never exit this thread */
else if (nb != sizeof (pack) || !pack.si.si_signo)