24 handler_ = [
this, f]() ->
void {
26 if (num_sigint_calls_ >= 3) {
27 LOG(INFO) <<
"^C pressed " << num_sigint_calls_
28 <<
" times. Forcing termination.";
31 LOG(INFO) <<
"^C pressed " << num_sigint_calls_ <<
" times. "
32 <<
"Interrupting the solver. Press 3 times to force termination.";
33 if (num_sigint_calls_ == 1) f();
35 signal(SIGINT, &ControlCHandler);
40void SigintHandler::ControlCHandler(
int sig) { handler_(); }
45thread_local std::function<void()> SigintHandler::handler_;
~SigintHandler()
Unregister the SIGINT handler.
void Register(const std::function< void()> &f)
In SWIG mode, we don't want anything besides these top-level includes.