From: Joel Brobecker <brobecker@adacore.com>
To: gdb@sourceware.org
Subject: Re: [mingw32] stdin redirection
Date: Thu, 12 Apr 2007 16:46:00 -0000 [thread overview]
Message-ID: <20070412164744.GL3886@adacore.com> (raw)
In-Reply-To: <20070412151221.GA856@caradoc.them.org>
> For a pipe, we use PeekNamedPipe to figure out how many bytes are
> available in the pipe and whether select on the pipe should return.
> For a file, we use the fallback case: we pass the file's HANDLE to
> WaitForMultipleObjects. What does a file HANDLE do when waited on?
> Maybe it's not the useful behavior.
I see what you mean now. I had a look at the MSDN documentation
for that function: They list the types of handles that can be used,
and they do not list files. However: They do not list pipes either.
So I'm wondering whether I'm looking at the right thing at all...
The WaitForMultipleObjects function can specify handles of any of
the following object types in the lpHandles array:
* Change notification
* Console input
* Event
* Memory resource notification
* Mutex
* Process
* Semaphore
* Thread
* Waitable timer
The only information we have at this point is that our experience
seems to show that WaitForMultipleObjects on a file seems to be
working. That is, working unless we did a PeekNamedPipe on its
handle beforehand...
> > If we could find a way to replace the current implementation of
> > fd_is_pipe into something that avoids using any of the pipe functions,
> > then that would probably solve our problem. Unfortunately, despite
> > our intensive search of MSDN, nothing turned up.
>
> To the best of my knowledge there is no way.
That's what we though too :-(.
> Are you sure that you tested any case in which fd_is_pipe returned
> true?
I just re-verified (see earlier email in that thread).
I had a look at what we were doing in gdb-6.4 (where things worked
for us), and we were actually doing a waitForMultipleObject call
for all handles unconditionally. So it's not so surprising that
Jerome's hack "works", it just reproduces the older behavior...
Your point about WaitForMultipleObjects regarding file handles
seem to suggest that we should be using something else for these
types of handle (I guess just fake a read-available event since
we'll always have something to read until we reach EOF). But the
issue remains the same though: How do we determine that we're
actually dealing with a file handle???
--
Joel
next prev parent reply other threads:[~2007-04-12 16:46 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-11 13:42 Jerome Guitton
2007-04-11 14:45 ` Daniel Jacobowitz
2007-04-11 14:51 ` Jerome Guitton
2007-04-11 15:12 ` Daniel Jacobowitz
2007-04-12 14:56 ` Joel Brobecker
2007-04-12 15:01 ` Dave Korn
2007-04-12 15:04 ` Dave Korn
[not found] ` <20070412155422.GI3886@adacore.com>
2007-04-12 15:58 ` Dave Korn
2007-04-12 16:06 ` Joel Brobecker
2007-04-12 16:09 ` Dave Korn
2007-04-12 15:12 ` Daniel Jacobowitz
2007-04-12 15:51 ` Joel Brobecker
2007-04-12 16:02 ` Daniel Jacobowitz
2007-04-12 16:04 ` Daniel Jacobowitz
2007-04-12 16:29 ` Joel Brobecker
2007-04-12 18:23 ` Daniel Jacobowitz
2007-04-12 18:56 ` Daniel Jacobowitz
2007-04-13 9:07 ` Joel Brobecker
2007-04-12 16:46 ` Joel Brobecker [this message]
2007-04-12 17:25 ` Dave Korn
2007-04-13 11:47 ` Jerome Guitton
2007-04-12 19:33 ` Eli Zaretskii
2007-04-12 19:37 ` Mark Kettenis
2007-04-12 19:51 ` Daniel Jacobowitz
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=20070412164744.GL3886@adacore.com \
--to=brobecker@adacore.com \
--cc=gdb@sourceware.org \
/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