cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Multithreaded use of libcurl

From: Ray Satiro via curl-library <curl-library_at_cool.haxx.se>
Date: Fri, 18 Sep 2015 00:53:19 -0400

On 9/17/2015 3:06 PM, doa379 wrote:
>>
>>> 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

That doesn't sound right. I think your solution is possibly covering up
a problem with the design of your program.
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-09-18