2 // Copyright Oliver Kowalke 2017.
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)
7 #if defined(BOOST_USE_UCONTEXT)
8 #include "boost/context/continuation_ucontext.hpp"
9 #elif defined(BOOST_USE_WINFIB)
10 #include "boost/context/continuation_winfib.hpp"
12 #include "boost/context/execution_context.hpp"
15 #include <boost/config.hpp>
17 #ifdef BOOST_HAS_ABI_HEADERS
18 # include BOOST_ABI_PREFIX
25 // zero-initialization
26 thread_local activation_record
* current_rec
;
27 thread_local
static std::size_t counter
;
30 activation_record_initializer::activation_record_initializer() noexcept
{
31 if ( 0 == counter
++) {
32 current_rec
= new activation_record();
36 activation_record_initializer::~activation_record_initializer() {
37 if ( 0 == --counter
) {
38 BOOST_ASSERT( current_rec
->is_main_context() );
48 activation_record::current() noexcept
{
49 // initialized the first time control passes; per thread
50 thread_local
static activation_record_initializer initializer
;
58 #ifdef BOOST_HAS_ABI_HEADERS
59 # include BOOST_ABI_SUFFIX