https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110196
--- Comment #12 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to [email protected] from comment #10) > > It is only called once, isn't it? > > Actually, _S_init is even called in a loop. And the singleton pattern is > also a code extension from me. Therefore, backtrace_create_state is also > called in a loop. No. _S_init is called multiple times, but it uses a local static variable for the result of calling backtrace_create_state: static __glibcxx_backtrace_state* __state = __glibcxx_backtrace_create_state(nullptr, 1, _S_err_handler, nullptr); return __state; That means the state is only created once (unless somebody compiles that code with -fno-threadsafe-statics and creates stacktraces in different threads concurrently, which would be their own fault). That code moved to src/c++23/statcktrace.cc but is still only called once: __glibcxx_backtrace_state* init() { #if __GTHREADS && ! defined(__cpp_threadsafe_static_init) # warning "std::stacktrace initialization will not be thread-safe" #endif static __glibcxx_backtrace_state* state = __glibcxx_backtrace_create_state(nullptr, 1, err_handler, nullptr); return state; } I still don't see a problem here, why do you think it's called more than once? > I don't feel experienced, to contribute STL code for more than x86_64. This has nothing to do with x86_64, it's about Linux vs non-Linux.
