2
0
mirror of https://github.com/boostorg/context.git synced 2026-01-19 04:02:17 +00:00

rename thread-local for fiber

- in context of #78
This commit is contained in:
Oliver Kowalke
2018-04-11 06:23:29 +02:00
parent 7900c86918
commit d08d608989

View File

@@ -21,20 +21,20 @@ namespace context {
namespace detail {
// zero-initialization
thread_local fiber_activation_record * current_rec;
thread_local fiber_activation_record * fib_current_rec;
thread_local static std::size_t counter;
// schwarz counter
fiber_activation_record_initializer::fiber_activation_record_initializer() noexcept {
if ( 0 == counter++) {
current_rec = new fiber_activation_record();
fib_current_rec = new fiber_activation_record();
}
}
fiber_activation_record_initializer::~fiber_activation_record_initializer() {
if ( 0 == --counter) {
BOOST_ASSERT( current_rec->is_main_context() );
delete current_rec;
BOOST_ASSERT( fib_current_rec->is_main_context() );
delete fib_current_rec;
}
}
@@ -46,7 +46,7 @@ fiber_activation_record *&
fiber_activation_record::current() noexcept {
// initialized the first time control passes; per thread
thread_local static fiber_activation_record_initializer initializer;
return current_rec;
return fib_current_rec;
}
}