Hi folks,

I think I am confused about thread safety provided by the shared interface 
handle with thread-safe lock function option.
As I understood from the documentation,  a lock function with proper thread 
locking mechanism (mutexes etc.) is supposed to provide thread-safe usage model 
for a shared interface handle used by different easy handles in multiple 
threads.

At the same time, as I can see in the 
https://curl.se/libcurl/c/CURLSHOPT_SHARE.html:

CURL_LOCK_DATA_COOKIE:    
     It is not supported to share cookies between multiple concurrent threads.

CURL_LOCK_DATA_SSL_SESSION
    It is not supported to share SSL sessions between multiple concurrent 
threads.

CURL_LOCK_DATA_CONNECT
   It is not supported to share connections between multiple concurrent threads.

So, I am wondering, if different easy handles running in different threads (and 
using different multi handles) may use the same shared interface handle with a 
thread-safe locking function?

If yes, then what the " It is not supported to share ... between multiple 
concurrent threads" warnings means?
If not, then what is the purpose of the locking function then?

I fully understand that multi and easy handles may not be used by multiple 
threads simultaneously,
but I expect that the share interface is supposed to allow sharing things 
between handles in different threads if these easy/multi handles are not 
accessed at the same time.

It would be very helpful to get a clarification on this matter to avoid trickly 
multi-threading issues.

Thanks,
Dmitry Karpov
-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html

Reply via email to