23 handler_ = [
this, f]() ->
void {
25 if (num_sigint_calls_ >= 3) {
26 LOG(
INFO) <<
"^C pressed " << num_sigint_calls_
27 <<
" times. Forcing termination.";
30 LOG(
INFO) <<
"^C pressed " << num_sigint_calls_ <<
" times. "
31 <<
"Interrupting the solver. Press 3 times to force termination.";
32 if (num_sigint_calls_ == 1) f();
34 signal(SIGINT, &ControlCHandler);
39 void SigintHandler::ControlCHandler(
int sig) { handler_(); }
44 thread_local std::function<void()> SigintHandler::handler_;