cURL / Mailing Lists / curl-library / Single Mail

curl-library

Can libcurl be used in multi-threaded mode?

From: Scott Simpson <simpsons_at_yahoo-inc.com>
Date: Mon, 26 Jul 2010 16:21:24 -0700

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 want to
separate these two concepts. That is, I want the event dispatcher to
notice when an fd has work to do but I want libcurl to handle the event
with a thread I hand it.

 

Here is the pseudo code for my start up program:

 

Check number of cores

Spawn 2 time the numbers of cores and put on "available threads" queue

Spawn a thread to send data (this will send out requests)

Main thread: In libevent, handle events. When an fd has work to do, pull
a thread off the "available threads" queue and use it to handle the
work. When the work is done, put back on the "available threads" queue.

 

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

 

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