cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Blocking variant of curl_multi_perform

From: Olaf van der Spek <olafvdspek_at_gmail.com>
Date: Wed, 10 Mar 2010 15:17:29 +0100

Take 2:
CURLMcode curl_multi_perform_sync(CURLM *multi_handle, int *running_handles)
{
        CURLMcode code;
        fd_set read;
        fd_set write;
        fd_set except;
        FD_ZERO(&read);
        FD_ZERO(&write);
        FD_ZERO(&except);
        int max_fd;
        code = curl_multi_fdset(multi_handle, &read, &write, &except, &max_fd);
        if (code != CURLM_OK)
                return code;
        long milliseconds;
        code = curl_multi_timeout(multi_handle, &milliseconds);
        if (code != CURLM_OK)
                return code;
        timeval timeout;
        timeout.tv_sec = 0;
        timeout.tv_usec = milliseconds == -1 ? 1000000 : 1000 * milliseconds;
        select(max_fd + 1, &read, &write, &except, &timeout);
        do
        {
                code = curl_multi_perform(multi_handle, running_handles);
        }
        while (code == CURLM_CALL_MULTI_PERFORM);
        return code;
}

On Tue, Mar 9, 2010 at 10:20 PM, Daniel Stenberg <daniel_at_haxx.se> wrote:
> On Tue, 9 Mar 2010, Olaf van der Spek wrote:
>
>> It's like pseudo code to explain the concept. What's wrong with it?
>
> There were so many it showed that no effort had been made to make it
> actually work. If you instead of writing a pseudo version actually try to
> write a working version, I'll gladly offer feedback.
>
> --
>
>  / daniel.haxx.se
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette:  http://curl.haxx.se/mail/etiquette.html
>
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-03-10