diff --git a/ctl/shared_ptr.h b/ctl/shared_ptr.h index 78cf4aeb2..6f04f2e9d 100644 --- a/ctl/shared_ptr.h +++ b/ctl/shared_ptr.h @@ -97,12 +97,12 @@ class shared_ref size_t use_count() const noexcept { - return shared + 1; + return __atomic_load_n(&shared, __ATOMIC_RELAXED) + 1; } size_t weak_count() const noexcept { - return weak; + return __atomic_load_n(&weak, __ATOMIC_RELAXED); } private: