bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH,HURD] hurdselect: Step1, code split preparations


From: Pino Toscano
Subject: Re: [PATCH,HURD] hurdselect: Step1, code split preparations
Date: Tue, 22 Jan 2013 21:15:06 +0100
User-agent: KMail/1.13.7 (Linux/3.2.0-4-amd64; KDE/4.8.4; x86_64; ; )

Alle martedì 22 gennaio 2013, Svante Signell ha scritto:
> On Tue, 2013-01-22 at 19:15 +0100, Pino Toscano wrote:
> > Alle martedì 22 gennaio 2013, Svante Signell ha scritto:
> > > Attached is the first patch for a 3-way split of hurdselect.c
> > > into three cases: DELAY, POLL, SELECT
> > 
> > What's the use of of the separate DELAY case?
> > 
> > Basically, it seems to be optimizing just a very specific case, 
i.e.:
> >   select(0, ..., &timeout);
> > 
> > while, on the other hand, code like
> > 
> >   fd_set empty;
> >   FD_ZERO(&empty);
> >   select(1, &empty, &empty, &empty, &timeout);
> > 
> > (or with any nfd > 0) with your changes would be considered as
> > SELECT.
> 
> If nfds>0 it depends on pollfds if the case is POLL or SELECT?
> 
> From the man page for select:
> Some code calls select() with all three sets empty, nfds zero, and a
> non-NULL timeout as a fairly portable way to sleep with subsecond
> precision.

I know what the select documentation says; what I said also is basically 
what you didn't reply to:

> > After all, the code checking the arguments should take care of
> > handling the "no descriptors" situations already, so the separate
> > DELAY is simply redundant (being a subset of SELECT).

Having a separate case for what is done as part of another one seems 
redudant to me.

> And of course calling poll with nfds=0 is equal to a delay too if
> timeout != 0

Actually, from my reading the poll documentation (unlike the select one) 
does not say what to do when nfds=0; on Linux, the timeout seems ignored 
and 0 is returned right away, with no delay.

-- 
Pino Toscano

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]