diff options
author | Kamil Dudka <kdudka@redhat.com> | 2010-04-24 12:14:21 +0200 |
---|---|---|
committer | Kamil Dudka <kdudka@redhat.com> | 2010-04-24 12:14:21 +0200 |
commit | d487ade72c5f31703ce097e8460e0225fad80348 (patch) | |
tree | fd22f7cbc0e11a42bafbc3d2099df6bb2f405ed4 /docs/examples/multi-single.c | |
parent | 71be565cf48f17b21eebbcde1ddba27c6e06d4c5 (diff) | |
download | curl-d487ade72c5f31703ce097e8460e0225fad80348.tar.gz |
test536: do not fail with threaded DNS resolver
Also tweaked comments in certain examples using curl_multi_fdset().
Diffstat (limited to 'docs/examples/multi-single.c')
-rw-r--r-- | docs/examples/multi-single.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/docs/examples/multi-single.c b/docs/examples/multi-single.c index 3e236f326..cba4f32cc 100644 --- a/docs/examples/multi-single.c +++ b/docs/examples/multi-single.c @@ -51,7 +51,7 @@ int main(int argc, char **argv) fd_set fdread; fd_set fdwrite; fd_set fdexcep; - int maxfd; + int maxfd = -1; FD_ZERO(&fdread); FD_ZERO(&fdwrite); @@ -65,8 +65,10 @@ int main(int argc, char **argv) curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd); /* In a real-world program you OF COURSE check the return code of the - function calls, *and* you make sure that maxfd is bigger than -1 so - that the call to select() below makes sense! */ + function calls. On success, the value of maxfd is guaranteed to be + greater or equal than -1. We call select(maxfd + 1, ...), specially in + case of (maxfd == -1), we call select(0, ...), which is basically equal + to sleep. */ rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout); |