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"
13 #include <boost/config.hpp>
15 #ifdef BOOST_HAS_ABI_HEADERS
16 # include BOOST_ABI_PREFIX
23 // zero-initialization
24 thread_local activation_record
* current_rec
;
25 thread_local
static std::size_t counter
;
28 activation_record_initializer::activation_record_initializer() noexcept
{
29 if ( 0 == counter
++) {
30 current_rec
= new activation_record();
34 activation_record_initializer::~activation_record_initializer() {
35 if ( 0 == --counter
) {
36 BOOST_ASSERT( current_rec
->is_main_context() );
46 activation_record::current() noexcept
{
47 // initialized the first time control passes; per thread
48 thread_local
static activation_record_initializer initializer
;
56 #ifdef BOOST_HAS_ABI_HEADERS
57 # include BOOST_ABI_SUFFIX