All that the standard says is that for shared_ptr<>
(20.7.2.2/4 "Class template shared_ptr"):
Changes in
use_count()
do not reflect modifications that can introduce data races
It doesn't say that those changes in use_count()
have to be lock free. The standard permits a mutex to be used to prevent the data race.
unique_ptr<>
has no promises to prevent data races (it's not intended to be thread safe on it's own).