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: http://github.com/bagder/curl/commit/f53347631eb4a5a075589e6fece43aced010a5bb#diff-2 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 examined. Kamil [1] http://www.opengroup.org/onlinepubs/009695399/functions/select.html ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.html
