Hacker News new | ask | show | jobs
by aidenn0 946 days ago
An atomic reference count seems sufficient, but I could be wrong.
1 comments

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.