cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Can libcurl be used in multi-threaded mode?

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 28 Jul 2010 20:59:24 +0200 (CEST)

On Mon, 26 Jul 2010, Scott Simpson wrote:

> I want to use libcurl with libevent. After reading the
> curl_multi_socket_action manual page, it seems that the event dispatcher and
> handling of an event wants to happen in a single thread.

I've only used event libraries that work that way: libevent and libev - unless
you do add more fancy stuff on your own.

But libcurl doesn't care about threads, it works on file descriptors so you
can play around with threads as much as you like as long as you stick to the
rules: only run with a specific curl handle in a single thread at a time.

So the answer would be: yes, libcurl can do it.

> Can libcurl do this? I want to keep ALL more cores busy, not just one.

AFAIK, or at least from what I've reckoned from users, most people run more
similar "engines" on each core and then hand over URLs to each engine to do
the entire work on the same core.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2010-07-28