mirror of
https://github.com/boostorg/context.git
synced 2026-01-19 16:12:17 +00:00
comments
This commit is contained in:
@@ -24,8 +24,10 @@ thread_local
|
||||
detail::activation_record::ptr_t
|
||||
detail::activation_record::current_rec;
|
||||
|
||||
// zero-initialization
|
||||
thread_local static std::size_t counter;
|
||||
|
||||
// schwarz counter
|
||||
activation_record_initializer::activation_record_initializer() {
|
||||
if ( 0 == counter++) {
|
||||
activation_record::current_rec.reset( new activation_record() );
|
||||
@@ -42,6 +44,7 @@ activation_record_initializer::~activation_record_initializer() {
|
||||
|
||||
execution_context
|
||||
execution_context::current() noexcept {
|
||||
// initialized the first time control passes; per thread
|
||||
thread_local static detail::activation_record_initializer initializer;
|
||||
return execution_context();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user