From bc0699f226ec55fde58a823fb818d8f8106c8fbd Mon Sep 17 00:00:00 2001 From: Constantine Sapuntzakis Date: Wed, 14 Jul 2010 00:32:53 +0200 Subject: examples: add curl_multi_timeout Make the multi-interface using examples use curl_multi_timeout to properly educate users how to do things. --- docs/examples/multi-debugcallback.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'docs/examples/multi-debugcallback.c') diff --git a/docs/examples/multi-debugcallback.c b/docs/examples/multi-debugcallback.c index 8e964c67b..fa90bbc48 100644 --- a/docs/examples/multi-debugcallback.c +++ b/docs/examples/multi-debugcallback.c @@ -142,6 +142,8 @@ int main(int argc, char **argv) fd_set fdexcep; int maxfd = -1; + long curl_timeo = -1; + FD_ZERO(&fdread); FD_ZERO(&fdwrite); FD_ZERO(&fdexcep); @@ -150,6 +152,15 @@ int main(int argc, char **argv) timeout.tv_sec = 1; timeout.tv_usec = 0; + curl_multi_timeout(multi_handle, &curl_timeo); + if(curl_timeo >= 0) { + timeout.tv_sec = curl_timeo / 1000; + if(timeout.tv_sec > 1) + timeout.tv_sec = 1; + else + timeout.tv_usec = (curl_timeo % 1000) * 1000; + } + /* get file descriptors from the transfers */ curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd); -- cgit v1.2.3