[PATCH v6 3/3] Cygwin: signal: Do not handle signal when __SIGFLUSHFAST is sent
Corinna Vinschen
corinna-cygwin@cygwin.com
Tue Jan 21 13:45:10 GMT 2025
Hi Takashi,
There's a minor style thingy and one question...
On Jan 21 12:15, Takashi Yano wrote:
> +++ b/winsup/cygwin/sigproc.cc
> @@ -742,6 +742,12 @@ sig_send (_pinfo *p, siginfo_t& si, _cygtls *tls)
> memcpy (p, si._si_commune._si_str, n); p += n;
> }
>
> + unsigned cw_mask;
> + if (pack.si.si_signo == __SIGFLUSHFAST)
> + cw_mask = 0;
> + else
> + cw_mask = cw_sig_restart;
> +
This could be a one-liner, unsigned cw_mask = ... ? ... : ...;
> DWORD nb;
> BOOL res;
> /* Try multiple times to send if packsize != nb since that probably
> @@ -751,8 +757,7 @@ sig_send (_pinfo *p, siginfo_t& si, _cygtls *tls)
> res = WriteFile (sendsig, leader, packsize, &nb, NULL);
> if (!res || packsize == nb)
> break;
> - if (cygwait (NULL, 10, cw_sig_eintr) == WAIT_SIGNALED)
> - _my_tls.call_signal_handler ();
> + cygwait (NULL, 10, cw_mask);
This bugs me a bit. While your solution nicely wraps the entire
timer problem into cygwait(), the downside is that each invocation
of cygwait() creates its own timer. Theoretically, given this is in a
loop with up to 100 iterations, you have up to 100 additional timer
create/destroy sequences.
So the question is, do you think this matters at all in this scenario,
given we're in a 10 ms wait state anyway?
If you think that's not an issue, feel free to apply the patch with
just the one-liner above.
Thanks,
Corinna
More information about the Cygwin-patches
mailing list