We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8c60232 commit f43dd8aCopy full SHA for f43dd8a
src/execution_context.cpp
@@ -24,8 +24,10 @@ thread_local
24
detail::activation_record::ptr_t
25
detail::activation_record::current_rec;
26
27
+// zero-initialization
28
thread_local static std::size_t counter;
29
30
+// schwarz counter
31
activation_record_initializer::activation_record_initializer() {
32
if ( 0 == counter++) {
33
activation_record::current_rec.reset( new activation_record() );
@@ -42,6 +44,7 @@ activation_record_initializer::~activation_record_initializer() {
42
44
43
45
execution_context
46
execution_context::current() noexcept {
47
+ // initialized the first time control passes; per thread
48
thread_local static detail::activation_record_initializer initializer;
49
return execution_context();
50
}
0 commit comments