https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66146
LIU Hao <lh_mouse at 126 dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lh_mouse at 126 dot com --- Comment #53 from LIU Hao <lh_mouse at 126 dot com> --- Why not implement `call_once` with `__cxa_guard_{acquire,release,abort}`? It's basically ``` template<typename _Callable, typename... _Args> void call_once(once_flag& __once, _Callable&& __callable, _Args&&... __args) { int __r = ::__cxa_guard_acquire(&__once); if(__r == 0) return; // passive __try { _INVOKE(forward<_Callable>(__callable), forward<_Args>(__args)...); } __catch(...) { ::__cxa_guard_abort(&__once); // exceptional __throw_exception_again; } ::__cxa_guard_release(&__once); // returning } ```