C++ Logo


Advanced search

Re: [std-proposals] Fwd: set_new_handler extension

From: Federico Kircheis <federico_at_[hidden]>
Date: Sun, 28 May 2023 17:30:02 +0000
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?

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)

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