cURL / Mailing Lists / curl-library / Single Mail


Re: POSIX threaded DNS resolver - first experiences

From: Kamil Dudka <>
Date: Sat, 24 Apr 2010 10:15:37 +0200

On Friday 23 of April 2010 22:21:24 Daniel Stenberg wrote:
> It looks like it should work indeed. Perhaps an added comment explaining
> how the maxfd < 0 case is treated (and why) would be suitable. I'm always a
> bit concerned that people will base something on our test cases and use
> them as examples, so I want them to be fairly well explained even if their
> main purpose is "just" testing.

My change was based on the code of docs/examples/multi-app.c. I feel some
inconsistency in the comment from there:

You say there we need to "make sure that maxfd is bigger than -1". But in
the code you intentionally do not in order to keep it working. What about
updating all the comments like following?

/* In a real-world program you OF COURSE check the return code of the function
   calls. On success, the value of maxfd is guaranteed to be greater or equal
   than than -1. We call select(maxfd + 1, ...), specially in case of
   (maxfd == -1), we call select(0, ...), which is basically equal to
   sleep. */

The specification [1] sounds clear to me:

   The nfds argument specifies the range of descriptors to be tested. The
   first nfds descriptors shall be checked in each set; that is, the
   descriptors from zero through nfds-1 in the descriptor sets shall be


List admin:
Received on 2010-04-24