C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Fwd: set_new_handler extension

From: Phil Bouchard <boost_at_[hidden]>
Date: Sun, 28 May 2023 13:40:29 -0400
On 5/28/23 13:30, Federico Kircheis via Std-Proposals wrote:
> On 28 May 2023 16:51:37 UTC, Phil Bouchard via Std-Proposals <std-proposals_at_[hidden]> wrote:
>>
>>
>> On 5/28/23 12:22, Phil Bouchard via Std-Proposals wrote:
>>>
>>> Besides, the aforementioned condition just involves a non-const member call in a compound statement so that can easily be automated with C++ Superset.
>>
>> Correction: it's a simple matter of automating the addition of an explicit lock() mechanism for each conditions using a container instance:
>>
>> if(std::lock_guard<std::mutex> lock(container.mutex()); container.empty())
>> {
>> container.insert(....)
>> }
>>
>>
>
> But then, what advantage does the mutex in the container provide?

Well I would keep the header I wrote the way it is so that the layer and
all dependencies stay thread-safe. The user-defined conditions on top of
that would require explicit locks of the recursive mutex.

Yes you might loose random nano seconds along the way but it's really
not important compared to the 100% thread safety benefits you gain.

> Why not use an external mutex and drop at least half of the containers to choose from, and compose independent features (being a container and being thread safe)

-- 
Logo <https://www.fornux.com/>  
*Phil Bouchard*  facebook icon
<https://www.linkedin.com/in/phil-bouchard-5723a910/> 
Founder & CEO
T: (819) 328-4743
E: phil_at_[hidden]| www.fornux.com <http://www.fornux.com>
8 rue de la Baie| Gatineau (Qc), J8T 3H3 Canada
Banner <https://goglobalawards.org/> Le message ci-dessus, ainsi que les
documents l'accompagnant, sont destinés uniquement aux personnes
identifiées et peuvent contenir des informations privilégiées,
confidentielles ou ne pouvant être divulguées. Si vous avez reçu ce
message par erreur, veuillez le détruire.
This communication (and/or the attachments) is intended for named
recipients only and may contain privileged or confidential information
which is not to be disclosed. If you received this communication by
mistake please destroy all copies.

Received on 2023-05-28 17:40:30