Sujet : Re: Atomic caching of smart pointers
De : chris.m.thomasson.1 (at) *nospam* gmail.com (Chris M. Thomasson)
Groupes : comp.lang.c++Date : 15. Sep 2024, 21:15:37
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vc7f99$2atht$6@dont-email.me>
References : 1
User-Agent : Mozilla Thunderbird
On 9/15/2024 11:54 AM, Paavo Helde wrote:
[...]
So, what do you think? Should I just use std::atomic<std::shared_ptr> instead? Any other suggestions? Did I get the memory order parameters right in compare_exchange_weak()?
Keep in mind that you need to make sure that std::atomic<std::shared_ptr> is actually lock-free...
Make sure to investigate is_always_lock_free on your various arch's:
https://en.cppreference.com/w/cpp/atomic/atomic/is_always_lock_free