curl-library
Re: CURL multi handle with easy handles from different threads
Date: Fri, 10 Jul 2015 11:09:38 +0100
Attached is an attempt at a sample program that creates 2 threads each
with an easy handle that is added to the global multi handle. It uses libuv
for socket event handling.
Each thread is supposed to continuously fetch data from an external server
(see http_get() thread function).
However, currently the 2 threads each fetch data from the external server
once and then nothing further happens. In case of CURL_POLL_REMOVE, I
ensure that uv_close is not called, so that further events on the socket
can be detected.
How can I make the external GET a continuous activity on the easy handle?
Thanks
Raj
On Fri, Jul 10, 2015 at 10:38 AM, Daniel Stenberg <daniel_at_haxx.se> wrote:
> On Fri, 10 Jul 2015, Ray Satiro via curl-library wrote:
>
> Generally there is something in libcurl I'm unclear about (I've asked on
>> the list before but didn't get a reply addressing it) which is it seems
>> that it's acceptable behavior for curl_multi_perform to always be
>> performing and not return for extended periods of time and I thought in
>> that case you can't call multi_add_handle from another thread during that
>> time.
>>
>
> There's no guarantee that this will work. As all internals are lock-free
> and assume exclusive access to lists etc there's a risk for data corruption
> if you do this.
>
> --
>
> / daniel.haxx.se
>
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette: http://curl.haxx.se/mail/etiquette.html
>
-- Rajalakshmi Iyer *Senior Software Engineer* raj-blismedia.com <http://is.gd/L42zBR>[image: Skype icon] [image: Blis logo] <http://www.blismedia.com/> <http://www.blismedia.com/> <https://www.facebook.com/BlisMedia?fref=ts> <https://twitter.com/BlisMedia> <https://www.linkedin.com/company/blismedia> <https://plus.google.com/u/0/103190831541608378945/about> -- This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of BlisMedia Ltd, a company registered in England and Wales with registered number 06455773. Its registered office is 3rd Floor, 101 New Cavendish St, London, W1W 6XH, United Kingdom. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error.
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
- text/x-c++src attachment: multi-app.cpp