public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
* [PATCH] Cygwin: pipe: Handle WAIT_CANCELED when waiting read_mtx.
@ 2021-11-10  8:23 Takashi Yano
  2021-11-10 10:35 ` Corinna Vinschen
  0 siblings, 1 reply; 2+ messages in thread
From: Takashi Yano @ 2021-11-10  8:23 UTC (permalink / raw)
  To: cygwin-patches

- Add missing handling for WAIT_CANCELED in cygwait() for read_mtx
  in raw_read().
---
 winsup/cygwin/fhandler_pipe.cc | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/fhandler_pipe.cc b/winsup/cygwin/fhandler_pipe.cc
index bc06d157c..13731437e 100644
--- a/winsup/cygwin/fhandler_pipe.cc
+++ b/winsup/cygwin/fhandler_pipe.cc
@@ -302,10 +302,18 @@ fhandler_pipe::raw_read (void *ptr, size_t& len)
       set_errno (EAGAIN);
       len = (size_t) -1;
       return;
-    default:
+    case WAIT_SIGNALED:
       set_errno (EINTR);
       len = (size_t) -1;
       return;
+    case WAIT_CANCELED:
+      pthread::static_cancel_self ();
+      /* NOTREACHED */
+    default:
+      /* Should not reach here. */
+      __seterrno ();
+      len = (size_t) -1;
+      return;
     }
   while (nbytes < len)
     {
-- 
2.33.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Cygwin: pipe: Handle WAIT_CANCELED when waiting read_mtx.
  2021-11-10  8:23 [PATCH] Cygwin: pipe: Handle WAIT_CANCELED when waiting read_mtx Takashi Yano
@ 2021-11-10 10:35 ` Corinna Vinschen
  0 siblings, 0 replies; 2+ messages in thread
From: Corinna Vinschen @ 2021-11-10 10:35 UTC (permalink / raw)
  To: cygwin-patches

On Nov 10 17:23, Takashi Yano wrote:
> - Add missing handling for WAIT_CANCELED in cygwait() for read_mtx
>   in raw_read().
> ---
>  winsup/cygwin/fhandler_pipe.cc | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/winsup/cygwin/fhandler_pipe.cc b/winsup/cygwin/fhandler_pipe.cc
> index bc06d157c..13731437e 100644
> --- a/winsup/cygwin/fhandler_pipe.cc
> +++ b/winsup/cygwin/fhandler_pipe.cc
> @@ -302,10 +302,18 @@ fhandler_pipe::raw_read (void *ptr, size_t& len)
>        set_errno (EAGAIN);
>        len = (size_t) -1;
>        return;
> -    default:
> +    case WAIT_SIGNALED:
>        set_errno (EINTR);
>        len = (size_t) -1;
>        return;
> +    case WAIT_CANCELED:
> +      pthread::static_cancel_self ();
> +      /* NOTREACHED */
> +    default:
> +      /* Should not reach here. */
> +      __seterrno ();
> +      len = (size_t) -1;
> +      return;
>      }
>    while (nbytes < len)
>      {
> -- 
> 2.33.0

ACK.  Please push.


Thanks,
Corinna

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-10 10:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-10  8:23 [PATCH] Cygwin: pipe: Handle WAIT_CANCELED when waiting read_mtx Takashi Yano
2021-11-10 10:35 ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).