effrey Walton wrote: > Be careful of call_once. > > Several years ago I cut over to C++11's call_once. The problem was, it > only worked reliably on 32-bit and 64-bit Intel platforms. It was a > disaster on Aarch64, PowerPC and Sparc. I had to back it out. > > The problems happened back when GCC 6 and 7 were popular. The problem > was due to something sideways in glibc. > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66146
This was/is a problem of std::call_once, implemented in libstdc++. Not about the call_once in C, implemented in glibc. > If you want a call_once-like initialization then rely on N2660: > Dynamic Initialization and Destruction with Concurrency. This too is about C++ only. AFAIU https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66146#c9, there's a conflict between call_once being compiled in C (and without special GCC options) and a callee that throws C++ exceptions. For you, it's a reminder to not use call_once. For me, it's more a reminder to not use C++. :-) Bruno