This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] PR libstdc++/86846 Alternative to pointer-width atomics


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.

Tested x86_64-linux, committed to trunk.


Attachment: patch.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]