mirror of
https://github.com/Z3Prover/z3
synced 2025-05-09 16:55:47 +00:00
Z3 sources
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
3f9edad676
commit
e9eab22e5c
1186 changed files with 381859 additions and 0 deletions
42
lib/scoped_ctrl_c.h
Normal file
42
lib/scoped_ctrl_c.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
/*++
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
scoped_ctrl_c.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Scoped control-c handler.
|
||||
|
||||
Author:
|
||||
|
||||
Leonardo de Moura (leonardo) 2011-04-27.
|
||||
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
#ifndef _SCOPED_CTRL_C_H_
|
||||
#define _SCOPED_CTRL_C_H_
|
||||
|
||||
#include"event_handler.h"
|
||||
|
||||
struct scoped_ctrl_c {
|
||||
event_handler & m_cancel_eh;
|
||||
bool m_first;
|
||||
bool m_once;
|
||||
bool m_enabled;
|
||||
void (*m_old_handler)(int);
|
||||
scoped_ctrl_c * m_old_scoped_ctrl_c;
|
||||
static scoped_ctrl_c * g_obj;
|
||||
static void on_ctrl_c(int);
|
||||
public:
|
||||
// If once == true, then the cancel_eh is invoked only at the first Ctrl-C.
|
||||
// The next time, the old signal handler will take over.
|
||||
// if enabled == false, then scoped_ctrl_c is a noop
|
||||
scoped_ctrl_c(event_handler & eh, bool once=true, bool enabled=true);
|
||||
~scoped_ctrl_c();
|
||||
void reset() { m_first = true; }
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue