Is shared_ptr swap thread safe?
No, swap
isn't thread safe, but there's another function that is:
atomic_store(&global, sp);
There's also atomic_exchange
which returns the old value, if you need that.
No, swap
isn't thread safe, but there's another function that is:
atomic_store(&global, sp);
There's also atomic_exchange
which returns the old value, if you need that.