alpaqa pantr
Nonconvex constrained optimization
Loading...
Searching...
No Matches
Functions
cancel.hpp File Reference
#include <atomic>
#include <csignal>
#include <memory>
#include <stdexcept>
+ Include dependency graph for cancel.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

template<auto & solver_to_stop>
auto attach_cancellation (auto &solver)
 Attach SIGINT and SIGTERM handlers to stop the given solver.
 

Function Documentation

◆ attach_cancellation()

auto attach_cancellation ( auto &  solver)

Attach SIGINT and SIGTERM handlers to stop the given solver.

Template Parameters
solver_to_stopReference to atomic pointer variable that will store a pointer to the solver, should be static, so it can be accessed from the signal handler without causing lifetime issues.
Parameters
solverThe solver that should be stopped by the handler.
Returns
A RAII object that detaches the handler when destroyed.

Definition at line 19 of file cancel.hpp.