C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Opt out of multi-threading protection for static variables inside functions

From: Jonathan Wakely <cxx_at_[hidden]>
Date: Sun, 27 Oct 2024 18:24:02 +0000
On Sun, 27 Oct 2024, 17:56 Thiago Macieira via Std-Proposals, <
std-proposals_at_[hidden]> wrote:

> On Sunday 27 October 2024 09:57:31 Pacific Daylight Time Frederick
> Virchanza
> Gotham via Std-Proposals wrote:
> > Sometimes we don't want this, for example if:
> > (1) The function will only ever be called by the same thread -- this
> > is very common in GUI programs (i.e. only the GUI thread calls the
> > function)
> > (2) You have your own locks inside the function
> >
> > C++ has always been about efficiency -- not paying for things that you
> > don't use. So how about we be able to opt out of the multi-threading
> > protection?
>
> This sounds like QoI request, though.
>

-fno-threadsafe-statics

Received on 2024-10-27 18:25:23