Repository: qpid-cpp Updated Branches: refs/heads/master fa27fd689 -> 3d18b1ddb
QPID-7671: Problem building on debian (unstable) distribution Replaced the one use of boost::serialization::singleton<Logger> with a simple POD-mutex singleton implementation. Project: http://git-wip-us.apache.org/repos/asf/qpid-cpp/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-cpp/commit/3d18b1dd Tree: http://git-wip-us.apache.org/repos/asf/qpid-cpp/tree/3d18b1dd Diff: http://git-wip-us.apache.org/repos/asf/qpid-cpp/diff/3d18b1dd Branch: refs/heads/master Commit: 3d18b1ddbfacb2b8cb6672d5193960bd29077540 Parents: fa27fd6 Author: Alan Conway <[email protected]> Authored: Tue Feb 14 16:11:39 2017 -0500 Committer: Alan Conway <[email protected]> Committed: Tue Feb 14 16:11:39 2017 -0500 ---------------------------------------------------------------------- src/qpid/log/Logger.cpp | 20 ++++++++------------ src/qpid/sys/posix/Mutex.h | 2 +- src/qpid/sys/windows/Mutex.h | 2 +- src/qpid/sys/windows/WinSocket.cpp | 1 - 4 files changed, 10 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-cpp/blob/3d18b1dd/src/qpid/log/Logger.cpp ---------------------------------------------------------------------- diff --git a/src/qpid/log/Logger.cpp b/src/qpid/log/Logger.cpp index fc254f2..c480eeb 100644 --- a/src/qpid/log/Logger.cpp +++ b/src/qpid/log/Logger.cpp @@ -24,13 +24,6 @@ #include "qpid/sys/Time.h" #include "qpid/DisableExceptionLogging.h" -#include "boost/version.hpp" -#if (BOOST_VERSION >= 104000) -#include <boost/serialization/singleton.hpp> -#else -#include <boost/pool/detail/singleton.hpp> -#endif - #include <boost/bind.hpp> #include <boost/function.hpp> #include <algorithm> @@ -51,12 +44,15 @@ inline void Logger::enable_unlocked(Statement* s) { s->enabled=selector.isEnabled(s->level, s->function, s->category); } +namespace { +sys::PODMutex loggerLock = QPID_MUTEX_INITIALIZER; +std::auto_ptr<Logger> logger; +} + Logger& Logger::instance() { -#if (BOOST_VERSION >= 104000) - return boost::serialization::singleton<Logger>::get_mutable_instance(); -#else - return boost::details::pool::singleton_default<Logger>::instance(); -#endif + sys::PODMutex::ScopedLock l(loggerLock); + if (!logger.get()) logger.reset(new Logger); + return *logger; } Logger::Logger() : flags(0) { http://git-wip-us.apache.org/repos/asf/qpid-cpp/blob/3d18b1dd/src/qpid/sys/posix/Mutex.h ---------------------------------------------------------------------- diff --git a/src/qpid/sys/posix/Mutex.h b/src/qpid/sys/posix/Mutex.h index e2b21b5..5d3cfb2 100644 --- a/src/qpid/sys/posix/Mutex.h +++ b/src/qpid/sys/posix/Mutex.h @@ -76,7 +76,7 @@ protected: /** * PODMutex is a POD, can be static-initialized with - * PODMutex m = QPID_PODMUTEX_INITIALIZER + * PODMutex m = QPID_MUTEX_INITIALIZER */ struct PODMutex { http://git-wip-us.apache.org/repos/asf/qpid-cpp/blob/3d18b1dd/src/qpid/sys/windows/Mutex.h ---------------------------------------------------------------------- diff --git a/src/qpid/sys/windows/Mutex.h b/src/qpid/sys/windows/Mutex.h index 5dcc69e..1bd88c4 100755 --- a/src/qpid/sys/windows/Mutex.h +++ b/src/qpid/sys/windows/Mutex.h @@ -86,7 +86,7 @@ protected: /** * PODMutex is a POD, can be static-initialized with - * PODMutex m = QPID_PODMUTEX_INITIALIZER + * PODMutex m = QPID_MUTEX_INITIALIZER */ struct PODMutex { http://git-wip-us.apache.org/repos/asf/qpid-cpp/blob/3d18b1dd/src/qpid/sys/windows/WinSocket.cpp ---------------------------------------------------------------------- diff --git a/src/qpid/sys/windows/WinSocket.cpp b/src/qpid/sys/windows/WinSocket.cpp index aada990..2af0383 100644 --- a/src/qpid/sys/windows/WinSocket.cpp +++ b/src/qpid/sys/windows/WinSocket.cpp @@ -44,7 +44,6 @@ namespace { static LONG volatile initialized = 0; class WinSockSetup { - // : public boost::details::pool::singleton_default<WinSockSetup> { public: WinSockSetup() { --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
