From 6cddd8a87a566c85f1e5ddf79319500891a35dde Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Tue, 5 Jun 2012 19:56:42 +0000 Subject: [PATCH] Fixed 'unused variable' warninings when compiling without thread safety --- include/cantera/base/ct_thread.h | 9 +++++++-- src/base/application.cpp | 8 +++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/include/cantera/base/ct_thread.h b/include/cantera/base/ct_thread.h index 42b446409..176b3a063 100644 --- a/include/cantera/base/ct_thread.h +++ b/include/cantera/base/ct_thread.h @@ -40,9 +40,14 @@ typedef boost::mutex mutex_t; typedef boost::mutex::scoped_lock ScopedLock; #else - typedef int mutex_t; -typedef int ScopedLock; + +class ScopedLock { +public: + explicit ScopedLock(const int m) : m_(m) {} +private: + int m_; +}; #endif // THREAD_SAFE_CANTERA diff --git a/src/base/application.cpp b/src/base/application.cpp index b7f3b017b..faeb0b0f5 100644 --- a/src/base/application.cpp +++ b/src/base/application.cpp @@ -35,14 +35,12 @@ cthreadId_t getThisThreadId() return pthread_self(); #endif } + #endif //! Mutex for input directory access static mutex_t dir_mutex; -//! Mutex for access to string messages -static mutex_t msg_mutex; - //! Mutex for creating singletons within the application object static mutex_t app_mutex; @@ -304,6 +302,10 @@ void Application::Messages::write_logfile(std::string file) #endif // WITH_HTML_LOGS #ifdef THREAD_SAFE_CANTERA + +//! Mutex for access to string messages +static mutex_t msg_mutex; + Application::Messages* Application::ThreadMessages::operator ->() { ScopedLock msgLock(msg_mutex);