Sha256: 7f865c9580671b92c71d4101fe8a368cb4cd9342faadb86a5b7d060296a0479c

Contents?: true

Size: 1.86 KB

Versions: 94

Compression:

Stored size: 1.86 KB

Contents

// 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 = {};

  }
}

#define BOOST_THREAD_LOG if (true) {} else boost::thread_detail::dummy_stream
#define BOOST_THREAD_END_LOG boost::thread_detail::dummy_stream

#endif

#define BOOST_THREAD_TRACE BOOST_THREAD_LOG << BOOST_THREAD_END_LOG


#endif // header

Version data entries

94 entries across 94 versions & 3 rubygems

Version Path
passenger-4.0.56 ext/boost/thread/detail/log.hpp
passenger-4.0.55 ext/boost/thread/detail/log.hpp
passenger-5.0.0.beta1 ext/boost/thread/detail/log.hpp
passenger-4.0.53 ext/boost/thread/detail/log.hpp
passenger-4.0.52 ext/boost/thread/detail/log.hpp
passenger-4.0.51 ext/boost/thread/detail/log.hpp
passenger-4.0.50 ext/boost/thread/detail/log.hpp
passenger-4.0.49 ext/boost/thread/detail/log.hpp
passenger-4.0.48 ext/boost/thread/detail/log.hpp
passenger-4.0.46 ext/boost/thread/detail/log.hpp
passenger-4.0.45 ext/boost/thread/detail/log.hpp
passenger-4.0.44 ext/boost/thread/detail/log.hpp
passenger-4.0.43 ext/boost/thread/detail/log.hpp
passenger-4.0.42 ext/boost/thread/detail/log.hpp
passenger-4.0.41 ext/boost/thread/detail/log.hpp
passenger-4.0.40 ext/boost/thread/detail/log.hpp
passenger-4.0.39 ext/boost/thread/detail/log.hpp
passenger-4.0.38 ext/boost/thread/detail/log.hpp
passenger-4.0.37 ext/boost/thread/detail/log.hpp
passenger-4.0.36 ext/boost/thread/detail/log.hpp