24 thread_local std::vector<Handler_t> rootErrorHandlers;
28 std::atomic<ErrorHandlerFunc_t> origHandler;
34 void errorHandler (
int level,
41 for (
int i = rootErrorHandlers.size()-1;
i >= 0; --
i) {
42 if (!rootErrorHandlers[
i] (
level, abort, location,
msg))
return;
45 origHandler.load() (
level, abort, location,
msg);
66 : m_size (rootErrorHandlers.
size()+1)
81 static std::once_flag
flag;
82 std::call_once (
flag, []() {
83 origHandler = ::SetErrorHandler (errorHandler);
84 if (::GetErrorHandler() != errorHandler) {
89 rootErrorHandlers.push_back (errhand);
100 if (
m_size != rootErrorHandlers.size()) std::abort();
101 rootErrorHandlers.pop_back();