diff options
Diffstat (limited to 'boost/serialization/singleton.hpp')
-rw-r--r-- | boost/serialization/singleton.hpp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/boost/serialization/singleton.hpp b/boost/serialization/singleton.hpp index fcb79c3694..a40488c6df 100644 --- a/boost/serialization/singleton.hpp +++ b/boost/serialization/singleton.hpp @@ -85,11 +85,19 @@ class BOOST_SYMBOL_VISIBLE singleton_module : public boost::noncopyable { private: - static bool & get_lock(); + BOOST_SERIALIZATION_DECL static bool & get_lock(); public: - BOOST_SERIALIZATION_DECL static void lock(); - BOOST_SERIALIZATION_DECL static void unlock(); - BOOST_SERIALIZATION_DECL static bool is_locked(); + static void lock(){ + get_lock() = true; + } + + static void unlock(){ + get_lock() = false; + } + + static bool is_locked(){ + return get_lock(); + } }; #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas @@ -111,6 +119,12 @@ bool detail::singleton_wrapper< T >::m_is_destroyed = false; } // detail +// note usage of BOOST_DLLEXPORT. These functions are in danger of +// being eliminated by the optimizer when building an application in +// release mode. Usage of the macro is meant to signal the compiler/linker +// to avoid dropping these functions which seem to be unreferenced. +// This usage is not related to autolinking. + template <class T> class singleton : public singleton_module { |