default_resource.h
399 Bytes
-
PR libstdc++/86846 Alternative to pointer-width atomics · 26e13048
Define a class using std::mutex for when std::atomic<memory_resource*> cannot be used to implement the default memory resource. When std::mutex constructor is not constexpr the constant_init trick won't work, so just define a global and use init_priority for it. The compiler warns about using reserved priority, so put the definition in a header file using #pragma GCC system_header to suppress the warning. PR libstdc++/86846 * src/c++17/default_resource.h: New file, defining default_res. * src/c++17/memory_resource.cc [ATOMIC_POINTER_LOCK_FREE != 2] (atomic_mem_res): Define alternative for atomic<memory_resource*> using a mutex instead of atomics. From-SVN: r263536
Jonathan Wakely committed