Re: [PATCH] http.c: Use curl_multi_fdset to select on curl fds instead of just sleeping
- From
Mika Fischer <mika.fischer@zoopnet.de>
- Date
- Oct 30, 2011, 07:19 UTC
- Message-ID
- <CAOs=hR+YuF+HP0n0132Ktm3RdeWsnVp0Bgt89LNn+VyT6W0mcw@mail.gmail.com>
- In-Reply-To
- <alpine.DEB.2.00.1110292230500.28196@tvnag.unkk.fr>
On Sat, Oct 29, 2011 at 22:33, Daniel Stenberg <daniel@haxx.se> wrote:
Show 12 quoted lines
>> + curl_multi_fdset(curlm, &readfds, &writefds, >> &excfds, &max_fd); >> + >> + select(max_fd+1, &readfds, &writefds, &excfds, >> &select_timeout); > > At times, curl_multi_fdset() might return -1 in max_fd, as when there's no > internal socket around to provide to the application to wait for. > > Calling select() with max_fd+1 (== 0) will then not be appreciated by all > implementations of select() so that case should probably also be covered by > the 50ms sleep approach...
Actually, the 50ms sleep was also implemented using select(0, ...) before the patch. I tried to keep the previous behavior when curl does not give us any information. I assumed that the select(0, ...) was some portable way to sleep with microsecond granularity. Is there some other way to tell select not to check any fds, or should I just call select(1, ...)?
Best, Mika