Skip to content

Commit e31e981

Browse files
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 <[email protected]>
1 parent ed5dd26 commit e31e981

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/params/context_params.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ void context_params::updt_params(params_ref const & p) {
157157
void context_params::collect_param_descrs(param_descrs & d) {
158158
insert_rlimit(d);
159159
insert_timeout(d);
160+
insert_ctrl_c(d);
160161
d.insert("well_sorted_check", CPK_BOOL, "type checker", "false");
161162
d.insert("type_check", CPK_BOOL, "type checker (alias for well_sorted_check)", "true");
162163
d.insert("auto_config", CPK_BOOL, "use heuristics to automatically select solver and configure it", "true");

src/util/scoped_ctrl_c.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Revision History:
1818
--*/
1919
#include<signal.h>
2020
#include "util/scoped_ctrl_c.h"
21+
#include "util/gparams.h"
2122

2223
static scoped_ctrl_c * g_obj = nullptr;
2324

@@ -41,6 +42,8 @@ scoped_ctrl_c::scoped_ctrl_c(event_handler & eh, bool once, bool enabled):
4142
m_once(once),
4243
m_enabled(enabled),
4344
m_old_scoped_ctrl_c(g_obj) {
45+
if (gparams::get_value("ctrl_c") == "false")
46+
m_enabled = false;
4447
if (m_enabled) {
4548
g_obj = this;
4649
m_old_handler = signal(SIGINT, on_ctrl_c);

0 commit comments

Comments
 (0)