diff options
author | Siesh1oo <siesh1oo@siesh1oo.no> | 2014-03-10 15:02:58 +0100 |
---|---|---|
committer | Siesh1oo <siesh1oo@siesh1oo.no> | 2014-03-10 15:02:58 +0100 |
commit | 8a0216bd9f81faf45e1ff463edcc6d82dfa20565 (patch) | |
tree | 1be3cd99e02ad1927b0a8f282059820786594884 | |
parent | 0fb044a58f7cc66364af3a0a53c8b5089e0149ad (diff) | |
download | yosys-8a0216bd9f81faf45e1ff463edcc6d82dfa20565.tar.gz yosys-8a0216bd9f81faf45e1ff463edcc6d82dfa20565.tar.bz2 yosys-8a0216bd9f81faf45e1ff463edcc6d82dfa20565.zip |
- libs/ezsat/ezminisat.cc: use POSIX.2001 sigaction() instead on non-portable signal().
-rw-r--r-- | libs/ezsat/ezminisat.cc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/libs/ezsat/ezminisat.cc b/libs/ezsat/ezminisat.cc index d488a9062..92f56b00a 100644 --- a/libs/ezsat/ezminisat.cc +++ b/libs/ezsat/ezminisat.cc @@ -25,7 +25,7 @@ #include <limits.h> #include <stdint.h> -#include <signal.h> +#include <csignal> #include <cinttypes> #include <minisat/core/Solver.h> @@ -170,14 +170,18 @@ contradiction: #endif } - sighandler_t old_alarm_sighandler = NULL; + struct sigaction sig_action; + struct sigaction old_sig_action; int old_alarm_timeout = 0; if (solverTimeout > 0) { + sig_action.sa_handler = alarmHandler; + sig_action.sa_mask = 0; + sig_action.sa_flags = 0; alarmHandlerThis = this; alarmHandlerTimeout = clock() + solverTimeout*CLOCKS_PER_SEC; old_alarm_timeout = alarm(0); - old_alarm_sighandler = signal(SIGALRM, alarmHandler); + sigaction(SIGALRM, &sig_action, &old_sig_action); alarm(1); } @@ -187,7 +191,7 @@ contradiction: if (alarmHandlerTimeout == 0) solverTimoutStatus = true; alarm(0); - signal(SIGALRM, old_alarm_sighandler); + sigaction(SIGALRM, &old_sig_action, NULL); alarm(old_alarm_timeout); } |