Handle signals without C API

This commit is contained in:
Stephen Shelton 2020-06-29 14:09:59 -06:00
parent b5d6a73ffd
commit ec4109ae60
No known key found for this signature in database
GPG Key ID: EE4BADACCE8B631C
1 changed files with 5 additions and 4 deletions

View File

@ -6,6 +6,7 @@
#include <util/logging/logger.hpp>
#include <util/logging/ostream_logger.hpp>
#include <util/str.hpp>
#include <util/thread/logic.hpp>
#include <csignal>
@ -53,10 +54,10 @@ std::promise<int> exit_code;
void
handle_signal(int sig)
{
// TODO: handle this without C API
(void)sig;
LogError("FIXME: handle signal");
abort();
if (ctx)
LogicCall(ctx->logic, std::bind(&llarp::Context::HandleSignal, ctx.get(), sig));
else
std::cerr << "Received signal " << sig << ", but have no context yet. Ignoring!" << std::endl;
}
#ifdef _WIN32