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

Add Z3_solver_interrupt to OCaml API (#6976)

This commit is contained in:
Christoph M. Wintersteiger 2023-10-31 15:48:06 +00:00 committed by GitHub
parent 91c2139b5d
commit 3af2b36cd7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 95 additions and 74 deletions

View file

@ -62,6 +62,9 @@ let mk_context (settings:(string * string) list) =
Z3native.enable_concurrent_dec_ref res; Z3native.enable_concurrent_dec_ref res;
res res
let interrupt (ctx:context) =
Z3native.interrupt ctx
module Symbol = module Symbol =
struct struct
type symbol = Z3native.symbol type symbol = Z3native.symbol
@ -1916,6 +1919,9 @@ struct
let add_simplifier = Z3native.solver_add_simplifier let add_simplifier = Z3native.solver_add_simplifier
let translate x = Z3native.solver_translate (gc x) x let translate x = Z3native.solver_translate (gc x) x
let to_string x = Z3native.solver_to_string (gc x) x let to_string x = Z3native.solver_to_string (gc x) x
let interrupt (ctx:context) (s:solver) =
Z3native.solver_interrupt ctx s
end end

View file

@ -48,6 +48,12 @@ type context
*) *)
val mk_context : (string * string) list -> context val mk_context : (string * string) list -> context
(** Interrupt the execution of a Z3 procedure.
This procedure can be used to interrupt: solvers, simplifiers and tactics.
Note: Tactic.interrupt is an alias for this. *)
val interrupt: context -> unit
(** Interaction logging for Z3 (** Interaction logging for Z3
Interaction logs are used to record calls into the API into a text file. Interaction logs are used to record calls into the API into a text file.
The text file can be replayed using z3. It has to be the same version of z3 The text file can be replayed using z3. It has to be the same version of z3
@ -3342,6 +3348,15 @@ sig
(** A string representation of the solver. *) (** A string representation of the solver. *)
val to_string : solver -> string val to_string : solver -> string
(** Solver local interrupt.
Normally you should use Z3_interrupt to cancel solvers because only
one solver is enabled concurrently per context.
However, per GitHub issue #1006, there are use cases where
it is more convenient to cancel a specific solver. Solvers
that are not selected for interrupts are left alone.*)
val interrupt: context -> solver -> unit
end end
(** Fixedpoint solving *) (** Fixedpoint solving *)