mirror of
https://github.com/moparisthebest/curl
synced 2024-08-13 17:03:50 -04:00
curl_multi_timeout.3: added example
This commit is contained in:
parent
46a050e9f5
commit
f6af9aef7e
@ -5,7 +5,7 @@
|
|||||||
.\" * | (__| |_| | _ <| |___
|
.\" * | (__| |_| | _ <| |___
|
||||||
.\" * \___|\___/|_| \_\_____|
|
.\" * \___|\___/|_| \_\_____|
|
||||||
.\" *
|
.\" *
|
||||||
.\" * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
|
.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
.\" *
|
.\" *
|
||||||
.\" * This software is licensed as described in the file COPYING, which
|
.\" * This software is licensed as described in the file COPYING, which
|
||||||
.\" * you should have received as part of this distribution. The terms
|
.\" * you should have received as part of this distribution. The terms
|
||||||
@ -49,6 +49,22 @@ SHOULD instead use \fIcurl_multi_setopt(3)\fP and its
|
|||||||
Note: if libcurl returns a -1 timeout here, it just means that libcurl
|
Note: if libcurl returns a -1 timeout here, it just means that libcurl
|
||||||
currently has no stored timeout value. You must not wait too long (more than a
|
currently has no stored timeout value. You must not wait too long (more than a
|
||||||
few seconds perhaps) before you call curl_multi_perform() again.
|
few seconds perhaps) before you call curl_multi_perform() again.
|
||||||
|
.SH EXAMPLE
|
||||||
|
.nf
|
||||||
|
struct timeval timeout;
|
||||||
|
long timeo;
|
||||||
|
|
||||||
|
curl_multi_timeout(multi_handle, &timeo);
|
||||||
|
if(timeo < 0)
|
||||||
|
/* no set timeout, use a default */
|
||||||
|
timeo = 980;
|
||||||
|
|
||||||
|
timeout.tv_sec = timeo / 1000;
|
||||||
|
timeout.tv_usec = (timeo % 1000) * 1000;
|
||||||
|
|
||||||
|
/* wait for activities no longer than the set timeout */
|
||||||
|
select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
|
||||||
|
.fi
|
||||||
.SH "RETURN VALUE"
|
.SH "RETURN VALUE"
|
||||||
The standard CURLMcode for multi interface error codes.
|
The standard CURLMcode for multi interface error codes.
|
||||||
.SH "TYPICAL USAGE"
|
.SH "TYPICAL USAGE"
|
||||||
|
Loading…
Reference in New Issue
Block a user