Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:52:46

0001 // Copyright (C) 2012 Vicente J. Botet Escriba
0002 //
0003 //  Distributed under the Boost Software License, Version 1.0. (See accompanying
0004 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0005 
0006 #ifndef BOOST_THREAD_DETAIL_LOG_HPP
0007 #define BOOST_THREAD_DETAIL_LOG_HPP
0008 
0009 #include <boost/thread/detail/config.hpp>
0010 #if defined BOOST_THREAD_USES_LOG
0011 #include <boost/thread/recursive_mutex.hpp>
0012 #include <boost/thread/lock_guard.hpp>
0013 #if defined BOOST_THREAD_USES_LOG_THREAD_ID
0014 #include <boost/thread/thread.hpp>
0015 #endif
0016 #include <iostream>
0017 
0018 namespace boost
0019 {
0020   namespace thread_detail
0021   {
0022     inline boost::recursive_mutex& terminal_mutex()
0023     {
0024       static boost::recursive_mutex mtx;
0025       return mtx;
0026     }
0027 
0028   }
0029 }
0030 #if defined BOOST_THREAD_USES_LOG_THREAD_ID
0031 
0032 #define BOOST_THREAD_LOG \
0033   { \
0034     boost::lock_guard<boost::recursive_mutex> _lk_(boost::thread_detail::terminal_mutex()); \
0035     std::cout << boost::this_thread::get_id() << " - "<<__FILE__<<"["<<__LINE__<<"] " <<std::dec
0036 #else
0037 
0038 #define BOOST_THREAD_LOG \
0039 { \
0040   boost::lock_guard<boost::recursive_mutex> _lk_(boost::thread_detail::terminal_mutex()); \
0041   std::cout << __FILE__<<"["<<__LINE__<<"] " <<std::dec
0042 
0043 #endif
0044 #define BOOST_THREAD_END_LOG \
0045     std::dec << std::endl; \
0046   }
0047 
0048 #else
0049 
0050 namespace boost
0051 {
0052   namespace thread_detail
0053   {
0054     struct dummy_stream_t
0055     {
0056     };
0057 
0058     template <typename T>
0059     inline dummy_stream_t const& operator<<(dummy_stream_t const& os, T)
0060     {
0061       return os;
0062     }
0063 
0064     inline dummy_stream_t const& operator<<(dummy_stream_t const& os, dummy_stream_t const&)
0065     {
0066       return os;
0067     }
0068 
0069 
0070     BOOST_CONSTEXPR_OR_CONST dummy_stream_t dummy_stream = {};
0071 
0072   }
0073 }
0074 
0075 #ifdef BOOST_MSVC
0076 #define BOOST_THREAD_LOG \
0077         __pragma(warning(suppress:4127)) /* conditional expression is constant */ \
0078         if (true) {} else boost::thread_detail::dummy_stream
0079 #else
0080 #define BOOST_THREAD_LOG if (true) {} else boost::thread_detail::dummy_stream
0081 #endif
0082 #define BOOST_THREAD_END_LOG boost::thread_detail::dummy_stream
0083 
0084 #endif
0085 
0086 #define BOOST_THREAD_TRACE BOOST_THREAD_LOG << BOOST_THREAD_END_LOG
0087 
0088 
0089 #ifdef BOOST_MSVC
0090 #define BOOST_DETAIL_THREAD_LOG \
0091         __pragma(warning(suppress:4127)) /* conditional expression is constant */ \
0092         if (false) {} else std::cout << std::endl << __FILE__ << "[" << __LINE__ << "]"
0093 #else
0094 #define BOOST_DETAIL_THREAD_LOG \
0095         if (false) {} else std::cout << std::endl << __FILE__ << "[" << __LINE__ << "]"
0096 #endif
0097 
0098 #endif // header