aboutsummaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2014-03-11 14:24:24 +0100
committerClifford Wolf <clifford@clifford.at>2014-03-11 14:24:24 +0100
commit91704a78531bec2e3eea3ddf90eaedb28e1d696d (patch)
treea3817eb12cebb9e9adc0f2375eda59ddb2d9004a /libs
parent9992026a8d4482abd8fbae8cb246a87cbbbde364 (diff)
downloadyosys-91704a78531bec2e3eea3ddf90eaedb28e1d696d.tar.gz
yosys-91704a78531bec2e3eea3ddf90eaedb28e1d696d.tar.bz2
yosys-91704a78531bec2e3eea3ddf90eaedb28e1d696d.zip
Merged a few fixes for non-posix systems from github.com/Siesh1oo/yosys
(see https://github.com/cliffordwolf/yosys/pull/28)
Diffstat (limited to 'libs')
-rw-r--r--libs/ezsat/ezminisat.cc12
-rw-r--r--libs/ezsat/ezsat.cc3
2 files changed, 10 insertions, 5 deletions
diff --git a/libs/ezsat/ezminisat.cc b/libs/ezsat/ezminisat.cc
index d488a9062..4677f68bd 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;
+ sigemptyset(&sig_action.sa_mask);
+ sig_action.sa_flags = SA_RESTART;
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);
}
diff --git a/libs/ezsat/ezsat.cc b/libs/ezsat/ezsat.cc
index fb3d24996..6da363fc1 100644
--- a/libs/ezsat/ezsat.cc
+++ b/libs/ezsat/ezsat.cc
@@ -19,10 +19,11 @@
#include "ezsat.h"
+#include <cmath>
#include <algorithm>
+#include <cassert>
#include <stdlib.h>
-#include <assert.h>
const int ezSAT::TRUE = 1;
const int ezSAT::FALSE = 2;