public inbox for cygwin-developers@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin-developers@cygwin.com
Subject: Re: cygwin 3.3.x: another problem that may be related to pipes
Date: Mon, 15 Nov 2021 17:25:07 +0100	[thread overview]
Message-ID: <YZKJ4zXni0j6Zojn@calimero.vinschen.de> (raw)
In-Reply-To: <20211115233601.f0c9717ee00908505534c976@nifty.ne.jp>

On Nov 15 23:36, Takashi Yano wrote:
> [...]
> IIUC, WaitForMultipleObject() cannot wait for pipe object.
> Only the following objects are allowed to be waited.
> 
> Change notification
> Console input
> Event
> Memory resource notification
> Mutex
> Process
> Semaphore
> Thread
> Waitable timer

Pipe handles shouldn't be any different than the above.  Please note
that you can also wait, for instance, for socket handles, which are not
in that list either.  It's just that it's tricky and the developer is
potentially doing something which *looks* correct, but doesn't what was
intended at all.

> If you pass the pipe handle to WFMO, it imediately returns WAIT_OBJECT_0,
> so your patch will work almost same with my patch.

If it returns with WAIT_OBJECT_0, something has certainly happened on
the pipe.  The problem is that it's not clear what has happened. If push
comes to shove, it could be a completed action actually performed by
another process.

So here's another brain-dead idea:

What if we create the event even in the nonblocking case?

Considering that the pipe is nonblocking, what *should* happen is this:

- NtReadFile return STATUS_PENDING
- WFMO/cygwait even with INFINITE timeout should return almost immediately
  with WAIT_OBJECT_0
- the io.Status contains a valid status including STATUS_PIPE_EMPTY if
  there's nothing to read

*If* that works, the code in blocking and nonblocking is suddenly
almost identical.  That would be nice, wouldn't it?  If only all
the interesting cases would be well documented...


Corinna

  parent reply	other threads:[~2021-11-15 16:25 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <115203324.649908.1636923059546.ref@mail.yahoo.com>
     [not found] ` <115203324.649908.1636923059546@mail.yahoo.com>
     [not found]   ` <20211115171811.844dce9cce2b4d13262d64f2@nifty.ne.jp>
2021-11-15 13:01     ` Corinna Vinschen
2021-11-15 13:57       ` Ken Brown
2021-11-15 14:36         ` Takashi Yano
2021-11-15 15:11           ` Takashi Yano
2021-11-15 15:27             ` Ken Brown
2021-11-15 15:36               ` Ken Brown
2021-11-15 16:45                 ` Takashi Yano
2021-11-15 16:25           ` Corinna Vinschen [this message]
2021-11-15 14:50       ` Takashi Yano
2021-11-15 16:08         ` Corinna Vinschen
2021-11-15 16:37           ` Ken Brown
2021-11-15 16:52             ` Takashi Yano
2021-11-15 18:47               ` Ken Brown
2021-11-15 23:35                 ` Takashi Yano
2021-11-15 23:49                   ` Ken Brown
2021-11-16  3:28                     ` Takashi Yano
2021-11-16  9:28                       ` Corinna Vinschen
2021-11-16  9:45                     ` Takashi Yano
2021-11-16 10:20                       ` Takashi Yano
2021-11-16 14:35                         ` Takashi Yano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YZKJ4zXni0j6Zojn@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin-developers@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).