Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r81532 - trunk/boost/thread/detail
From: vicente.botet_at_[hidden]
Date: 2012-11-25 13:27:07


Author: viboes
Date: 2012-11-25 13:27:06 EST (Sun, 25 Nov 2012)
New Revision: 81532
URL: http://svn.boost.org/trac/boost/changeset/81532

Log:
Thread: update log so that we can choose to don't use the this_thread::get_id.
Text files modified:
   trunk/boost/thread/detail/log.hpp | 13 ++++++++++++-
   1 files changed, 12 insertions(+), 1 deletions(-)

Modified: trunk/boost/thread/detail/log.hpp
==============================================================================
--- trunk/boost/thread/detail/log.hpp (original)
+++ trunk/boost/thread/detail/log.hpp 2012-11-25 13:27:06 EST (Sun, 25 Nov 2012)
@@ -9,7 +9,10 @@
 #include <boost/thread/detail/config.hpp>
 #if defined BOOST_THREAD_USES_LOG
 #include <boost/thread/recursive_mutex.hpp>
+#include <boost/thread/lock_guard.hpp>
+#if defined BOOST_THREAD_USES_LOG_THREAD_ID
 #include <boost/thread/thread.hpp>
+#endif
 #include <iostream>
 
 namespace boost
@@ -24,12 +27,20 @@
 
   }
 }
+#if defined BOOST_THREAD_USES_LOG_THREAD_ID
 
 #define BOOST_THREAD_LOG \
   { \
- boost::lock_guard<boost::recursive_mutex> lk(boost::thread_detail::terminal_mutex()); \
+ boost::lock_guard<boost::recursive_mutex> _lk_(boost::thread_detail::terminal_mutex()); \
     std::cout << boost::this_thread::get_id() << " - "<<__FILE__<<"["<<__LINE__<<"] " <<std::dec
+#else
 
+#define BOOST_THREAD_LOG \
+{ \
+ boost::lock_guard<boost::recursive_mutex> _lk_(boost::thread_detail::terminal_mutex()); \
+ std::cout << __FILE__<<"["<<__LINE__<<"] " <<std::dec
+
+#endif
 #define BOOST_THREAD_END_LOG \
     std::dec << std::endl; \
   }


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk