Details
-
Task
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
None
-
None
-
13
-
Foundation PM Staging
Description
*Do NOT look into existing stdlib implementations if you consider implementing this*
The interface to access atomic operations has changed between C++11/14/17¹, Concurrency-TS² and C++20+³, and the old way was immediately deprecated in C++20 and is going to be removed in C++26.
This suggests to write a q20::atomic that is specialized for shared_ptr to use the C++11 API and falls back to std::atomic for everything else. In C++20 mode, it is then an alias for std::atomic. You won't be able to implement the atomic wait and notify API of std20::atomic, but that's ok under the rules of the qNN namespace: the guarantee is only from the q20:: implementation to the std one, not vice versa.
¹ https://en.cppreference.com/w/cpp/memory/shared_ptr/atomic
² https://en.cppreference.com/w/cpp/experimental/atomic_shared_ptr
³ https://en.cppreference.com/w/cpp/memory/shared_ptr/atomic2