3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-22 08:35:31 +00:00

Add an option "ctrl_c" that can be used to disable Ctrl-C signal handling (#7619)

Add this option, so that the z3 library can be used in programs that do
signal handling on their own.

Signed-off-by: Mikulas Patocka <mikulas@twibright.com>
This commit is contained in:
mikulas-patocka 2025-04-18 19:34:54 +02:00 committed by GitHub
parent ed5dd26bb7
commit e31e9819b1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 0 deletions

View file

@ -157,6 +157,7 @@ void context_params::updt_params(params_ref const & p) {
void context_params::collect_param_descrs(param_descrs & d) {
insert_rlimit(d);
insert_timeout(d);
insert_ctrl_c(d);
d.insert("well_sorted_check", CPK_BOOL, "type checker", "false");
d.insert("type_check", CPK_BOOL, "type checker (alias for well_sorted_check)", "true");
d.insert("auto_config", CPK_BOOL, "use heuristics to automatically select solver and configure it", "true");

View file

@ -18,6 +18,7 @@ Revision History:
--*/
#include<signal.h>
#include "util/scoped_ctrl_c.h"
#include "util/gparams.h"
static scoped_ctrl_c * g_obj = nullptr;
@ -41,6 +42,8 @@ scoped_ctrl_c::scoped_ctrl_c(event_handler & eh, bool once, bool enabled):
m_once(once),
m_enabled(enabled),
m_old_scoped_ctrl_c(g_obj) {
if (gparams::get_value("ctrl_c") == "false")
m_enabled = false;
if (m_enabled) {
g_obj = this;
m_old_handler = signal(SIGINT, on_ctrl_c);