mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 17:15:31 +00:00
fix #1276 related crashes for re-sumption after cancellation
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
bec60f763b
commit
05428314be
5 changed files with 31 additions and 11 deletions
|
@ -21,6 +21,7 @@ Revision History:
|
|||
|
||||
reslimit::reslimit():
|
||||
m_cancel(0),
|
||||
m_suspend(false),
|
||||
m_count(0),
|
||||
m_limit(0) {
|
||||
}
|
||||
|
@ -31,12 +32,12 @@ uint64 reslimit::count() const {
|
|||
|
||||
bool reslimit::inc() {
|
||||
++m_count;
|
||||
return m_cancel == 0 && (m_limit == 0 || m_count <= m_limit);
|
||||
return (m_cancel == 0 && (m_limit == 0 || m_count <= m_limit)) || m_suspend;
|
||||
}
|
||||
|
||||
bool reslimit::inc(unsigned offset) {
|
||||
m_count += offset;
|
||||
return m_cancel == 0 && (m_limit == 0 || m_count <= m_limit);
|
||||
return (m_cancel == 0 && (m_limit == 0 || m_count <= m_limit)) || m_suspend;
|
||||
}
|
||||
|
||||
void reslimit::push(unsigned delta_limit) {
|
||||
|
|
|
@ -23,12 +23,14 @@ Revision History:
|
|||
|
||||
class reslimit {
|
||||
volatile unsigned m_cancel;
|
||||
bool m_suspend;
|
||||
uint64 m_count;
|
||||
uint64 m_limit;
|
||||
svector<uint64> m_limits;
|
||||
ptr_vector<reslimit> m_children;
|
||||
|
||||
void set_cancel(unsigned f);
|
||||
friend class scoped_suspend_rlimit;
|
||||
|
||||
public:
|
||||
reslimit();
|
||||
|
@ -42,7 +44,7 @@ public:
|
|||
uint64 count() const;
|
||||
|
||||
|
||||
bool get_cancel_flag() const { return m_cancel > 0; }
|
||||
bool get_cancel_flag() const { return m_cancel > 0 && !m_suspend; }
|
||||
char const* get_cancel_msg() const;
|
||||
void cancel();
|
||||
void reset_cancel();
|
||||
|
@ -61,6 +63,17 @@ public:
|
|||
|
||||
};
|
||||
|
||||
class scoped_suspend_rlimit {
|
||||
reslimit & m_limit;
|
||||
public:
|
||||
scoped_suspend_rlimit(reslimit& r): m_limit(r) {
|
||||
r.m_suspend = true;
|
||||
}
|
||||
~scoped_suspend_rlimit() {
|
||||
m_limit.m_suspend = false;
|
||||
}
|
||||
};
|
||||
|
||||
struct scoped_limits {
|
||||
reslimit& m_limit;
|
||||
unsigned m_sz;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue