diff --git a/include/boost/detail/lwm_nop.hpp b/include/boost/detail/lwm_nop.hpp index 1d798e0..671a5b0 100644 --- a/include/boost/detail/lwm_nop.hpp +++ b/include/boost/detail/lwm_nop.hpp @@ -24,30 +24,9 @@ namespace detail class lightweight_mutex { -private: - - lightweight_mutex(lightweight_mutex const &); - lightweight_mutex & operator=(lightweight_mutex const &); - public: - lightweight_mutex() - { - } - - class scoped_lock - { - private: - - scoped_lock(scoped_lock const &); - scoped_lock & operator=(scoped_lock const &); - - public: - - explicit scoped_lock(lightweight_mutex &) - { - } - }; + typedef lightweight_mutex scoped_lock; }; } // namespace detail diff --git a/include/boost/detail/shared_count.hpp b/include/boost/detail/shared_count.hpp index d513329..9dfed4f 100644 --- a/include/boost/detail/shared_count.hpp +++ b/include/boost/detail/shared_count.hpp @@ -74,7 +74,9 @@ public: void add_ref() { +#ifdef BOOST_HAS_THREADS lightweight_mutex::scoped_lock lock(mtx_); +#endif if(use_count_ == 0) throw use_count_is_zero(); ++use_count_; ++weak_count_; @@ -86,7 +88,9 @@ public: long new_weak_count; { +#ifdef BOOST_HAS_THREADS lightweight_mutex::scoped_lock lock(mtx_); +#endif new_use_count = --use_count_; new_weak_count = --weak_count_; } @@ -106,7 +110,9 @@ public: void weak_add_ref() // nothrow { +#ifdef BOOST_HAS_THREADS lightweight_mutex::scoped_lock lock(mtx_); +#endif ++weak_count_; } @@ -115,7 +121,9 @@ public: long new_weak_count; { +#ifdef BOOST_HAS_THREADS lightweight_mutex::scoped_lock lock(mtx_); +#endif new_weak_count = --weak_count_; } @@ -127,7 +135,9 @@ public: long use_count() const // nothrow { +#ifdef BOOST_HAS_THREADS lightweight_mutex::scoped_lock lock(mtx_); +#endif return use_count_; } @@ -145,7 +155,9 @@ private: long use_count_; long weak_count_; +#ifdef BOOST_HAS_THREADS mutable lightweight_mutex mtx_; +#endif void (*self_deleter_) (counted_base *); };