https://rethinkdb.com/blog/handling-stack-overflow-on-custom-stacks/

https://barrgroup.com/embedded-systems/how-to/prevent-detect-stack-overflow 

etc.
{
    fatal_error_callback = std::move(callback);
    if (!thread_group)
        return;
    std::lock_guard lock(thread_group->mutex);
    thread_group->fatal_error_callback = fatal_error_callback;
}
void ThreadStatus::onFatalError()
{
    if (fatal_error_callback)
        fatal_error_callback();
}
ThreadStatus * MainThreadStatus::main_thread = nullptr;
MainThreadStatus & MainThreadStatus::getInstance()
{
    static MainThreadStatus thread_status;
    return thread_status;
}
MainThreadStatus::MainThreadStatus()
    : ThreadStatus()
{
    main_thread = current_thread;
}
MainThreadStatus::~MainThreadStatus()
{
    main_thread = nullptr;
}
}