CURLMcode curl_multi_wait(CURLM *multi_handle,
struct curl_waitfd extra_fds[],
unsigned int extra_nfds,
- int timeout_ms);
+ int timeout_ms,
+ int *ret);
.ad
.SH DESCRIPTION
This function polls on all file descriptors used by the curl easy handles
The calling application may pass additional curl_waitfd structures which are
similar to \fIpoll(2)\fP's pollfd structure to be waited on in the same call.
+On completion, if \fIret\fI is supplied, it will be populated with the
+number of file descriptors on which interesting events occured.
+
This function is encouraged to be used instead of select(3) when using the
multi interface to allow applications to easier circumvent the common problem
with 1024 maximum file descriptors.
CURL_EXTERN CURLMcode curl_multi_wait(CURLM *multi_handle,
struct curl_waitfd extra_fds[],
unsigned int extra_nfds,
- int timeout_ms);
+ int timeout_ms,
+ int *ret);
/*
* Name: curl_multi_perform()
CURLMcode curl_multi_wait(CURLM *multi_handle,
struct curl_waitfd extra_fds[],
unsigned int extra_nfds,
- int timeout_ms)
+ int timeout_ms,
+ int *ret)
{
struct Curl_multi *multi=(struct Curl_multi *)multi_handle;
struct Curl_one_easy *easy;
}
/* wait... */
- Curl_poll(ufds, nfds, timeout_ms);
+ i = Curl_poll(ufds, nfds, timeout_ms);
free(ufds);
+ if(ret)
+ *ret = i;
return CURLM_OK;
}
abort_on_test_timeout();
while(still_running) {
- res = curl_multi_wait(multi, NULL, 0, TEST_HANG_TIMEOUT);
+ int num;
+ res = curl_multi_wait(multi, NULL, 0, TEST_HANG_TIMEOUT, &num);
if (res != CURLM_OK) {
printf("curl_multi_wait() returned %d\n", res);
res = -1;
goto test_cleanup;
}
+ if (num != 1) {
+ printf("curl_multi_wait() returned on %d handle(s), expected 1\n", num);
+ res = -1;
+ goto test_cleanup;
+ }
abort_on_test_timeout();