Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
Kranar
· 1y ago · 0 comments
It's a common misconception that std::shared_ptr is thread safe. The counter is thread safe, but the actual shared_ptr itself can not be shared across multiple threads.
There is now atomic_shared_ptr which is thread safe.
Comments
[–]
mococa
1y ago
It is now a template specialization of atomic std::atomic<std::shared_ptr<T>>.