yield.h
1 // Copyright 2003-2013 Christopher M. Kohlhoff
2 // Copyright Oliver Kowalke, Nat Goodspeed 2015.
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
6 
7 #pragma once
8 #include <boost/system/error_code.hpp>
9 
10 namespace util {
11 namespace fibers_ext {
12 
13 //[fibers_asio_yield_t
14 class yield_t {
15 public:
16  yield_t() = default;
17 
30  yield_t operator[]( boost::system::error_code & ec) const {
31  yield_t tmp;
32  tmp.ec_ = & ec;
33  return tmp;
34  }
35 
36 //private:
37  // ptr to bound error_code instance if any
38  boost::system::error_code * ec_{ nullptr };
39 };
40 
42 extern thread_local yield_t yield;
43 //]
44 
45 } // namespace fibers_ext
46 } // namespace util
47 
48 #include "detail/yield.hpp"
yield_t operator[](boost::system::error_code &ec) const
Definition: yield.h:30