make test optional correct.

attempt to fixe singleton: locked problem for mingw
This commit is contained in:
Robert Ramey
2017-06-04 11:36:14 -07:00
parent 0c8a1d615a
commit bebea0fda9
2 changed files with 19 additions and 11 deletions

View File

@@ -81,29 +81,29 @@ namespace serialization {
// attempt to retieve a mutable instances while locked will
// generate a assertion if compiled for debug.
// 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.
class BOOST_SYMBOL_VISIBLE singleton_module :
public boost::noncopyable
{
private:
BOOST_SERIALIZATION_DECL static bool & get_lock();
public:
static void lock(){
BOOST_DLLEXPORT static void lock(){
get_lock() = true;
}
static void unlock(){
BOOST_DLLEXPORT static void unlock(){
get_lock() = false;
}
static bool is_locked(){
BOOST_DLLEXPORT static bool is_locked(){
return get_lock();
}
};
// 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
{