Terminator
This class encapsulates a user-specified terminator, which allows to terminate
queries of a solver.
It is configured via
cvc5::Solver::setTerminator()
.
-
class
Terminator
-
A terminator, which allows to terminate queries of a solver.
A terminator is connected to a solver via Solver::setTerminator() . While the solver executes a query (e.g., Solver::checkSat() ), it periodically calls terminate() to determine whether the query should be terminated. If terminate() returns true, the query is terminated as if a resource limit had been reached. For queries that return a Result , the result is unknown with explanation UnknownExplanation::INTERRUPTED .
A termination request only applies to the query during which it was issued: after terminate() returned true, it is not called again during that query, and the solver can be used for further queries afterwards. Function terminate() is called at the beginning of each query, i.e., if it keeps returning true, subsequent queries are terminated immediately.
Function terminate() is called frequently from the thread that executes the query, and must thus be cheap to evaluate. It is declared
noexcept, since it is called from code that is not exception-safe (e.g., the SAT solvers): an exception that escapes it terminates the program. To terminate a query from another thread, terminate() can, e.g., check a flag of typestd::atomic<bool>that is set by that thread.Warning
This class is experimental and may change in future versions.