Subject: Re: Observations on select.cc (19990922 snapshot)
From: [email-masked] (Patrick J. LoPresti)
To: Chris Faylor <[email-masked]>
Cc: [email-masked]
Date: 25 Sep 1999 13:55:26 -0400

>>>>> "cgf" == Chris Faylor <[email-masked]> writes:

 cgf> Looking at a recent strace output, I don't see any occurrences
 cgf> of PeekNamedPipe failures.  So, I'm not sure where this is
 cgf> frequently being called.

It happens any time anyone does a select() to see if they can write to
a pipe.  The "always_ready" test in select() succeeds, and select()
then calls sellect_stuff::poll().  This loops through all of the
select records, calling s->poll() on each.  For a pipe, this means
calling poll_pipe() as decided by fhandler_pipe::select_write() (or
fhandler_pipe::select_read() if the pipe was in both the read and
write fd_sets).

 cgf> PeekNamedPipe is supposed to be called with a pipe handle which
 cgf> has GENERIC_READ attributes.  I don't know what you consider the
 cgf> output side of a pipe but I wouldn't expect an output handle to
 cgf> have GENERIC_READ attributes.

By "output side" I meant the side of the pipe out of which data are
coming.  Sorry for being ambiguous.

 cgf> Hmm.  I assume that this paragraph is your "clunky" way of
 cgf> trying to start a technical discussion.  You do realize that
 cgf> when you send mail here mailing list you stand a chance of
 cgf> communicating with the original author of the code, right?  I'll
 cgf> grant you that the word "clunky" did get my attention but
 cgf> certainly not in a positive way.

Sorry; I meant no offense!  I did not mean that the code is bad.  I
just meant that when I tried to convince myself that this particular
invariant was enforced, I found it difficult; and at the same time, I
saw a way to make it easy.  I will try to use less loaded words when
describing trivial problems.

 cgf> However, you're right that the *_selected test should be in
 cgf> set_bits.  I don't agree that all of the *_selected tests should
 cgf> be eliminated elsewhere, however.

Personally, I would either enforce the invariant everywhere and then
*ASSERT* it in set_bits(); or I would enforce it in set_bits() and not
bother elsewhere.  Naturally, your tastes may differ :-).

 - Pat

--
Want to unsubscribe from this list?
Send a message to [email-masked]