Sortix volatile manual
This manual documents Sortix volatile, a development build that has not been officially released. You can instead view this document in the latest official manual.
curl_multi_waitfds(3) | Library Functions Manual | curl_multi_waitfds(3) |
NAME
curl_multi_waitfds - extract file descriptor information from a multi handleSYNOPSIS
#include <curl/curl.h>
#include <stdlib.h>
CURLMcode curl_multi_waitfds(CURLM *multi,
struct curl_waitfd *ufds,
unsigned int size,
unsigned int *fd_count);
DESCRIPTION
This function extracts curl_waitfd structures which are similar to poll(2)'s pollfd structure from a given multi_handle.PROTOCOLS
This functionality affects all supported protocolsEXAMPLE
int main(void)
{
CURLMcode mc;
struct curl_waitfd *ufds;
CURLM *multi = curl_multi_init();
do {
/* call curl_multi_perform() */
/* get the count of file descriptors from the transfers */
unsigned int fd_count = 0;
mc = curl_multi_waitfds(multi, NULL, 0, &fd_count);
if(mc != CURLM_OK) {
fprintf(stderr, "curl_multi_waitfds() failed, code %d.\n", mc);
break;
}
if(!fd_count)
continue; /* no descriptors yet */
/* Allocate storage for our descriptors.
* Note that a better approach can be used to minimize allocations and
* deallocations, if needed, like pre-allocated or grow-only array.
*/
ufds = (struct curl_waitfd*)malloc(fd_count * sizeof(struct curl_waitfd));
/* get wait descriptors from the transfers and put them into array. */
mc = curl_multi_waitfds(multi, ufds, fd_count, NULL);
if(mc != CURLM_OK) {
fprintf(stderr, "curl_multi_waitfds() failed, code %d.\n", mc);
free(ufds);
break;
}
/* Do polling on descriptors in ufds */
free(ufds);
} while (!mc);
}
AVAILABILITY
Added in curl 8.8.0RETURN VALUE
CURLMcode type, general libcurl multi interface error code. See libcurl-errors(3)SEE ALSO
curl_multi_fdset(3), curl_multi_perform(3), curl_multi_poll(3), curl_multi_wait(3)2024-11-23 | libcurl |