Re:Why does unsafe multithreaded std:unordered_map crash mor...
by aidenn0 on Thursday November 09, 2023 @12:56AM
(#38201670)
An atomic reference count seems sufficient, but I could be wrong.
[ Parent
| on HN ]
Re:Why does unsafe multithreaded std:unordered_map crash mor...
by gpderetta on Thursday November 09, 2023 @07:00AM
(#38203917)
It is actually quite tricky to lock-free swap a concurrently-accessed reference counted pointer. The reference count is not associated with the pointer, but with the pointee, so a 2CAS is not enough.
Typically you need hazard pointers or similar deferred reclamation tricks.