3 ms·
Atomic references counting is a necessary technology when you want to do reference counting for an object shared by multiple threads. This applies both when doi
by tsimionescu 4y ago
Atomic references counting is a necessary technology when you want to do reference counting for an object shared by multiple threads. This applies both when doing manual reference counting (Rust's Arc, C++'s std::shared_ptr) or when doing automatic reference counting (objects in Swift, Objective C, Python).
Choosing to use automatic reference counting in a language is a design choice, with positives and negatives. Atomic reference counting is an implementation detail, a strict necessity whenever you can't be sure an object will only be referenced by one thread (in essence, non-atomic reference counting is just an optimization).