cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: using multi interfaces in different threads

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Tue, 1 Feb 2011 23:00:08 -0800

On Wed, Feb 02, 2011 at 12:18:32PM +0530, Arunkumar Manickam wrote:
> Our application is using curl multi interfaces merely so it can have control
> over when to perform the http transfer.
>
> For each http transfer a multi handle is created and an easy handle is added to
> it. And each http transfer happens in a separate thread which keeps calling
> into curl_multi_perform whenever there is something to read/write. We observe
> some rare crashes when more than one thread is inside curl_multi_perform at the
> same time.
>
> Are the curl multi interface functions re-entrant and thread safe. Is the
> application expected to some locking before entering in to multi perform. Pls
> help.

You should be fine, as long as you're not sharing handles between multiple
threads and you install the correct locking functions when required (and
you initialize the library correctly at the beginning). See
http://curl.haxx.se/libcurl/features.html#thread

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-02-02