diff options
Diffstat (limited to 'boost/fiber/detail/fss.hpp')
-rw-r--r-- | boost/fiber/detail/fss.hpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/boost/fiber/detail/fss.hpp b/boost/fiber/detail/fss.hpp index 54dc5b79d3..27a7d67f26 100644 --- a/boost/fiber/detail/fss.hpp +++ b/boost/fiber/detail/fss.hpp @@ -38,12 +38,13 @@ public: friend inline void intrusive_ptr_add_ref( fss_cleanup_function * p) noexcept { - ++p->use_count_; + p->use_count_.fetch_add( 1, std::memory_order_relaxed); } friend inline void intrusive_ptr_release( fss_cleanup_function * p) noexcept { - if ( --p->use_count_ == 0) { + if ( 1 == p->use_count_.fetch_sub( 1, std::memory_order_release) ) { + std::atomic_thread_fence( std::memory_order_acquire); delete p; } } |