C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Fwd: set_new_handler extension

From: Federico Kircheis <federico_at_[hidden]>
Date: Sun, 28 May 2023 17:04:30 +0200
On 28/05/2023 16.55, Phil Bouchard via Std-Proposals wrote:
> This is pretty much what I had in mind:
> https://github.com/philippeb8/std__ts/blob/master/ts.h
>
> Very cost / beneficial.
>


One of the issues I have with such classes is that they make other tools
for finding bugs, like sanitizers and valgrind, useless.

This code is racy, even with the internal mutex:

if(container.empty()){
   container.insert(....)
}


but since the data is protected by mutexes and synchronized, not tools
will complain (AFAIK).

Thus even if such class would be standardized, in most cases it is
useless/it is a not a good primitive for multi-threaded code.

Federico

Received on 2023-05-28 15:04:39