3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-29 20:05:51 +00:00

fix handling of global parameters, exceptions when optimization call gets cancelled

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2017-02-21 17:04:10 -08:00
parent 122a12c980
commit 77aac8d96f
3 changed files with 10 additions and 5 deletions

View file

@ -129,6 +129,7 @@ extern "C" {
cancel_eh<reslimit> eh(mk_c(c)->m().limit());
unsigned timeout = to_optimize_ptr(o)->get_params().get_uint("timeout", mk_c(c)->get_timeout());
unsigned rlimit = mk_c(c)->get_rlimit();
std::cout << "Timeout: " << timeout << "\n";
api::context::set_interruptable si(*(mk_c(c)), eh);
{
scoped_timer timer(timeout, &eh);
@ -137,8 +138,13 @@ extern "C" {
r = to_optimize_ptr(o)->optimize();
}
catch (z3_exception& ex) {
mk_c(c)->handle_exception(ex);
r = l_undef;
if (ex.msg() == "canceled" && mk_c(c)->m().canceled()) {
to_optimize_ptr(o)->set_reason_unknown(ex.msg());
}
else {
mk_c(c)->handle_exception(ex);
}
}
// to_optimize_ref(d).cleanup();
}