[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/boostorg/thread/develop/example/this_executor.cpp [Back]  [Original]

// Copyright (C) 2014 Vicente Botet
//
//  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)

#include 
#if ! defined  BOOST_NO_CXX11_DECLTYPE
#define BOOST_RESULT_OF_USE_DECLTYPE
#endif

#define BOOST_THREAD_VERSION 5
#define BOOST_THREAD_USES_LOG_THREAD_ID

#include 
#include 
#include 
#include 
#include 
#include 
#include 

#include 

struct current_executor_state_type {
  boost::shared_ptr current_executor_ptr;

  template 
  void set_current_executor(Executor& ex)
  {
    current_executor_ptr = boost::make_shared(ex);
  }
  boost::generic_executor_ref current_executor()
  {
    if (current_executor_ptr)
      return *current_executor_ptr;
    else
      throw "";
  }
};

thread_local current_executor_state_type current_executor_state;

boost::generic_executor_ref current_executor()
{
  return current_executor_state.current_executor();
}

void p2()
{
  std::cout 

Web Proxy Viewer  |  New URL  |  Original Page