3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-10-07 16:31:55 +00:00

adding rlimit resource limit facility to provide platform and architecture independent method for canceling activities

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2015-09-28 13:37:59 -07:00
parent ad16cc0ce2
commit 9b3e242990
26 changed files with 165 additions and 14 deletions

View file

@ -38,6 +38,7 @@ Revision History:
#include"statistics.h"
#include"stopwatch.h"
#include"trace.h"
#include"rlimit.h"
namespace sat {
@ -71,6 +72,7 @@ namespace sat {
struct abort_solver {};
protected:
volatile bool m_cancel;
reslimit& m_rlimit;
config m_config;
stats m_stats;
extension * m_ext;
@ -145,7 +147,7 @@ namespace sat {
friend class bceq;
friend struct mk_stat;
public:
solver(params_ref const & p, extension * ext);
solver(params_ref const & p, reslimit& l, extension * ext);
~solver();
// -----------------------
@ -238,6 +240,7 @@ namespace sat {
clause_offset get_offset(clause const & c) const { return m_cls_allocator.get_offset(&c); }
void checkpoint() {
if (m_cancel) throw solver_exception(Z3_CANCELED_MSG);
if (!m_rlimit.inc()) { m_cancel = true; throw solver_exception(Z3_CANCELED_MSG); }
++m_num_checkpoints;
if (m_num_checkpoints < 10) return;
m_num_checkpoints = 0;
@ -415,6 +418,7 @@ namespace sat {
void user_push();
void user_pop(unsigned num_scopes);
void pop_to_base_level();
reslimit& rlimit() { return m_rlimit; }
// -----------------------
//
// Simplification