This is the mail archive of the cygwin-patches mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Implement sigtimedwait


Hi Mark,

Thanks for sigtimedwait!  Two questions:

On Dec 13 22:54, Mark Geisert wrote:
> diff --git a/winsup/cygwin/signal.cc b/winsup/cygwin/signal.cc
> index 69c5e2aad..0599d8a3e 100644
> --- a/winsup/cygwin/signal.cc
> +++ b/winsup/cygwin/signal.cc
> [...]
> +	}
> +      cwaittime.QuadPart = (LONGLONG) timeout->tv_sec * NSPERSEC
> +                          + ((LONGLONG) timeout->tv_nsec + 99LL) / 100LL;
> +    }
> +
> +  return sigwait_common (set, info, timeout ? &cwaittime : cw_infinite);

Would you mind to change the name of cwaittime to waittime throughout?
The leading "cw" actually puzzeled me for a while since I misinterpreted
it as one of the cw_* constants.  No idea if it's just my bad eyes, but
dropping the leading c might raise readability a bit.

> +static int
> +sigwait_common (const sigset_t *set, siginfo_t *info, PLARGE_INTEGER cwaittime)
>  {
>    int res = -1;
>  
> @@ -602,7 +630,7 @@ sigwaitinfo (const sigset_t *set, siginfo_t *info)
>        set_signal_mask (_my_tls.sigwait_mask, *set);
>        sig_dispatch_pending (true);
>  
> -      switch (cygwait (NULL, cw_infinite, cw_sig_eintr | cw_cancel | cw_cancel_self))
> +      switch (cygwait (NULL, cwaittime, cw_sig_eintr | cw_cancel | cw_cancel_self))
>  	{
>  	case WAIT_SIGNALED:
>  	  if (!sigismember (set, _my_tls.infodata.si_signo))

What I'm missing here is the handling of WAIT_TIMEOUT.  In this case,
the default case currently tries to set errno, but no error actually
occured in cygwait, just a timeout.  However, WAIT_TIMEOUT should
explicitely set errno to EAGAIN.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

Attachment: signature.asc
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]