curl / Mailing Lists / curl-library / Single Mail

curl-library

curl handles and multi thread

From: surya chandrika via curl-library <curl-library_at_cool.haxx.se>
Date: Wed, 8 Nov 2017 15:25:15 +0530

Hi all,

From this link it says
https://curl.haxx.se/libcurl/c/threadsafe.html

You must never share the same handle in multiple threads. You can pass the
handles around among threads, but you must never use a single handle from
more than one thread at any given time.

Usecase: (cpp)
1. Get a multi handle and post an async req
2. If still_running = 1 push them into a global map
3. another thread which actively parse this map to select() the handles.
(one thread dedicated for selection for pending request)
4. If an activity is detected another thread from threadpool perform multi
perform.

So using a proper locking mechanism i understand that i should be able
to perform the above without any exception.

Please let me know if this understanding is correct.

Thanks
Surya

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2017-11-08