ltlcheck: disable timeout handling when kill() or alarm() are missing
* configure.ac: Check for kill and alarm. * src/bin/ltlcheck.cc: Disable timeout code when kill or alarm are missing. Recognize the --timeout option, but display a warning.
This commit is contained in:
parent
e46ae2799f
commit
f40925f67b
2 changed files with 19 additions and 2 deletions
|
|
@ -70,7 +70,7 @@ AX_CHECK_GSPNLIB
|
|||
AX_CHECK_BOOST([1.34], [103400])
|
||||
|
||||
AC_CHECK_HEADERS([sys/times.h])
|
||||
AC_CHECK_FUNCS([times srand48 drand48])
|
||||
AC_CHECK_FUNCS([times srand48 drand48 kill alarm])
|
||||
|
||||
LT_CONFIG_LTDL_DIR([ltdl])
|
||||
LT_INIT([win32-dll])
|
||||
|
|
|
|||
|
|
@ -51,6 +51,14 @@
|
|||
#include "tgbaalgos/stats.hh"
|
||||
#include "tgbaalgos/isdet.hh"
|
||||
|
||||
// Disable handling of timeout on systems that miss kill() or alarm().
|
||||
// For instance MinGW.
|
||||
#if HAVE_KILL && HAVE_ALARM
|
||||
# define ENABLE_TIMEOUT 1
|
||||
#else
|
||||
# define ENABLE_TIMEOUT 0
|
||||
#endif
|
||||
|
||||
const char argp_program_doc[] ="\
|
||||
Call several LTL/PSL translators and cross-compare their output to detect \
|
||||
bugs, or to gather statistics. The list of formulas to use should be \
|
||||
|
|
@ -226,6 +234,10 @@ parse_opt(int key, char* arg, struct argp_state*)
|
|||
break;
|
||||
case 'T':
|
||||
timeout = to_pos_int(arg);
|
||||
#if !ENABLE_TIMEOUT
|
||||
std::cerr << "warning: setting a timeout is not supported "
|
||||
<< "on your platform" << std::endl;
|
||||
#endif
|
||||
break;
|
||||
case OPT_DENSITY:
|
||||
density = to_probability(arg);
|
||||
|
|
@ -252,8 +264,9 @@ create_tmpfile(char c, unsigned int n, std::string& name)
|
|||
}
|
||||
|
||||
|
||||
static volatile int alarm_on = 0;
|
||||
static volatile bool timed_out = false;
|
||||
#if ENABLE_TIMEOUT
|
||||
static volatile int alarm_on = 0;
|
||||
static int child_pid = -1;
|
||||
static volatile int signal_received = 0;
|
||||
|
||||
|
|
@ -338,6 +351,10 @@ exec_with_timeout(const char* cmd)
|
|||
}
|
||||
return status;
|
||||
}
|
||||
#else // !ENABLE_TIMEOUT
|
||||
#define exec_with_timeout(cmd) system(cmd)
|
||||
#define setup_sig_handler() while (0);
|
||||
#endif // !ENABLE_TIMEOUT
|
||||
|
||||
namespace
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue