cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Question about threads

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 11 Jan 2007 13:11:03 +0100 (CET)

On Mon, 8 Jan 2007, cbenitov_at_ya.com wrote:

> I want to make several FTP calls from diferent threads at the same time and
> I donīt know if I must use the easy or the multi interface.

You can pick the one you like. libcurl is designed to be thread-safe, and if
you use a *nix you should tell it not to use signals.

> My doubt is if I use multi I can make a particular call on only a handle or
> all the calls are made when I invoque curl_multi_perform.

If you use the multi interface, you make things "happen" by calling
curl_multi_perform() or curl_multi_socket(). It is no difference in usage if
you have one handle or ten thousand handles added.

> On the other hand if I use easy interface from different threads at the same
> time the library will synchronize making step by step ?

The easy interface can be used in multiple threads simultaneously as long as
you create separate easy handles in each thread and then libcurl won't
synchronize anything since there will be no need to.

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2007-01-11