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
signature.asc
Description: This is a digitally signed message part.