Remove thread_ctrl::atexit

It was only a workaround for poor C++11 thread_local support
This commit is contained in:
Nekotekina 2018-09-15 14:42:14 +03:00
parent f2229a5f53
commit c5676e5649
4 changed files with 16 additions and 57 deletions

View file

@ -1446,10 +1446,11 @@ s32 error_code::error_report(const fmt_type_info* sup, u64 arg, const fmt_type_i
static thread_local std::unordered_map<std::string, std::size_t> g_tls_error_stats;
static thread_local std::string g_tls_error_str;
if (g_tls_error_stats.empty())
if (!sup)
{
thread_ctrl::atexit([]
if (!sup2)
{
// Report and clean error state
for (auto&& pair : g_tls_error_stats)
{
if (pair.second > 3)
@ -1457,7 +1458,10 @@ s32 error_code::error_report(const fmt_type_info* sup, u64 arg, const fmt_type_i
LOG_ERROR(GENERAL, "Stat: %s [x%u]", pair.first, pair.second);
}
}
});
g_tls_error_stats.clear();
return 0;
}
}
logs::channel* channel = &logs::GENERAL;