How does an atomic<shared_ptr<>>
work internally ? I’m not asking for the mechanics of the control block alongside with the stored data, which is easy to imagine for me, but for the atomic<shared_ptr<>>
itself.
For VC++ the code for the atomic store is that:
void store(shared_ptr<_Ty> _Value, const memory_order _Order = memory_order_seq_cst) noexcept {
_Check_store_memory_order(_Order);
const auto _Rep = this->_Repptr._Lock_and_load();
remove_extent_t<_Ty>* const _Tmp = _Value._Ptr;
_Value._Ptr = this->_Ptr.load(memory_order_relaxed);
this->_Ptr.store(_Tmp, memory_order_relaxed);
this->_Repptr._Store_and_unlock(_Value._Rep);
_Value._Rep = _Rep;
}
But this doesn’t help me much.