Blame view

3rdparty/boost_1_81_0/boost/thread/detail/log.hpp 2.41 KB
0b6a182c   Hu Chunming   添加无鉴权注册和注销
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
  // Copyright (C) 2012 Vicente J. Botet Escriba
  //
  //  Distributed under the Boost Software License, Version 1.0. (See accompanying
  //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  
  #ifndef BOOST_THREAD_DETAIL_LOG_HPP
  #define BOOST_THREAD_DETAIL_LOG_HPP
  
  #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
  {
    namespace thread_detail
    {
      inline boost::recursive_mutex& terminal_mutex()
      {
        static boost::recursive_mutex mtx;
        return mtx;
      }
  
    }
  }
  #if defined BOOST_THREAD_USES_LOG_THREAD_ID
  
  #define BOOST_THREAD_LOG \
    { \
      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; \
    }
  
  #else
  
  namespace boost
  {
    namespace thread_detail
    {
      struct dummy_stream_t
      {
      };
  
      template <typename T>
      inline dummy_stream_t const& operator<<(dummy_stream_t const& os, T)
      {
        return os;
      }
  
      inline dummy_stream_t const& operator<<(dummy_stream_t const& os, dummy_stream_t const&)
      {
        return os;
      }
  
  
      BOOST_CONSTEXPR_OR_CONST dummy_stream_t dummy_stream = {};
  
    }
  }
  
  #ifdef BOOST_MSVC
  #define BOOST_THREAD_LOG \
          __pragma(warning(suppress:4127)) /* conditional expression is constant */ \
          if (true) {} else boost::thread_detail::dummy_stream
  #else
  #define BOOST_THREAD_LOG if (true) {} else boost::thread_detail::dummy_stream
  #endif
  #define BOOST_THREAD_END_LOG boost::thread_detail::dummy_stream
  
  #endif
  
  #define BOOST_THREAD_TRACE BOOST_THREAD_LOG << BOOST_THREAD_END_LOG
  
  
  #ifdef BOOST_MSVC
  #define BOOST_DETAIL_THREAD_LOG \
          __pragma(warning(suppress:4127)) /* conditional expression is constant */ \
          if (false) {} else std::cout << std::endl << __FILE__ << "[" << __LINE__ << "]"
  #else
  #define BOOST_DETAIL_THREAD_LOG \
          if (false) {} else std::cout << std::endl << __FILE__ << "[" << __LINE__ << "]"
  #endif
  
  #endif // header