diff --git a/include/boost/fiber/future/detail/shared_state.hpp b/include/boost/fiber/future/detail/shared_state.hpp index c0dccea1..407865e6 100644 --- a/include/boost/fiber/future/detail/shared_state.hpp +++ b/include/boost/fiber/future/detail/shared_state.hpp @@ -276,7 +276,7 @@ template< typename R > class shared_state< R & > : public noncopyable { private: - std::size_t use_count_; + atomic< std::size_t > use_count_; mutable mutex mtx_; mutable condition waiters_; bool ready_; @@ -467,7 +467,7 @@ template<> class shared_state< void > : public noncopyable { private: - std::size_t use_count_; + atomic< std::size_t > use_count_; mutable mutex mtx_; mutable condition waiters_; bool ready_;