cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Multithreaded use of libcurl

From: doa379 <doa379_at_gmail.com>
Date: Thu, 17 Sep 2015 20:06:41 +0100

>
>> I'm trying to use libcurl in a distinct pthread but the process gets
>> stuck in the callback function as the url works like a socket and is
>> constantly giving out data:
>>
>> curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, callbackFunc);
>
> Why would it get stuck because of that?
>
>> I would to implement a thread which allows to fork the libcurl process
>> whilst other threads are still running. Even if the url doesn't finish
>> giving out data.
>>
>> What's the best way to implement this?
>
> Start a new thread/process and call the libcurl functions in there?
>
>> Is there a better way to implement this other than making discrete and
>> manual connections to the url?
>
> I don't understand. Are you using curl_easy_perform() to do the transfers?
>

Hi Dan,

Yes I am using curl_easy_perform() on the curl handle.

I think my issue has resolved itself by putting in a delay to some of
the operations in the threads. I am getting the expected behaviour as
shown by this example:

http://curl.haxx.se/libcurl/c/multithread.html

Thanks for your reply.

Regards,
Joe
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-09-17