Boost logo

Boost Users :

Subject: Re: [Boost-users] [system] local static and threading in C++03
From: Gottlob Frege (gottlobfrege_at_[hidden])
Date: 2013-01-02 13:22:04


On Mon, Dec 24, 2012 at 8:40 AM, Felipe Magno de Almeida <
felipe.m.almeida_at_[hidden]> wrote:

> Hello,
>
> Boost.System returns the system_category this way:
>
> BOOST_SYSTEM_DECL const error_category & system_category()
> {
> static const system_error_category system_category_const;
> return system_category_const;
> }
>
> But couldn't this make double construction/double free in C++03 systems
> if system_category is ran concurrently?
>
> Regards,
> --
> Felipe Magno de Almeida
>

If this is in a cpp file and not a header, then just move
system_category_const outside the function.

Tony



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net