curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder Daniel himself.

Re: Question about thread safety of shared interface handle

From: Dmitry Karpov via curl-library <curl-library_at_lists.haxx.se>
Date: Thu, 5 Sep 2024 21:39:41 +0000

It seems that currently the share object allows to share data between easy handles only if they are not used in different threads concurrently.
This is the only thread-safe scenario of sharing data, and it doesn't make sense to use lock functions as they will not guarantee thread safety.

Thanks for clarification!
Dmitry Karpov


-----Original Message-----
From: Daniel Stenberg <daniel_at_haxx.se>
Sent: Thursday, September 5, 2024 2:26 PM
To: Dmitry Karpov via curl-library <curl-library_at_lists.haxx.se>
Cc: Dmitry Karpov <dkarpov_at_roku.com>
Subject: [EXTERNAL] Re: Question about thread safety of shared interface handle

On Thu, 5 Sep 2024, Dmitry Karpov via curl-library wrote:

> 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?

The locking functions were implemented to make shares possible to use across threads, but as the documentation states they should not because the implementation unfortunately is just not complete enough for that.

-- 
  / daniel.haxx.se
  | Commercial curl support up to 24x7 is available!
  | Private help, bug fixes, support, ports, new features
  | https://curl.se/support.html
-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html
Received on 2024-09-05