boostorg / container

STL-like containers from Boost
http://www.boost.org/libs/container/
Boost Software License 1.0
96 stars 116 forks source link

fix static initialization issues in pmr global resources #148

Closed mucki-at closed 4 years ago

mucki-at commented 4 years ago

make sure that pmr global resources are constructed on first use so that they can be successfully used during static initialization (ie: before main()). Caveats: unless "magic statics" are supported by the compiler the very first call to new_delete_resource() and null_memory_resource() is not thread-safe.

igaztanaga commented 4 years ago

Thanks for the report. Based on your patch, I've implemented a solution that also works in C++03 and ensures static initialization based on existing boost singleton implementations.

mucki-at commented 4 years ago

Thank you, much appreciated. Unfortunately it doesn't quite fix the issue (see my comments in your commit)

On Sat, May 23, 2020 at 2:40 PM Ion Gaztañaga notifications@github.com wrote:

Closed #148 https://github.com/boostorg/container/pull/148 via 093467e https://github.com/boostorg/container/commit/093467e1d3e05b93b48e38517750239c6649a63e .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/boostorg/container/pull/148#event-3367446266, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFR6C7IBVYCZJWJRE6L5ZDDRTA7FJANCNFSM4NFO2FLA .

igaztanaga commented 4 years ago

Let's see if this fixes the issue and also supports C++03