1 #include <../../nrnconf.h>
8 #if defined(HAVE_SETITIMER) && defined(HAVE_SIGACTION)
16 static struct itimerval
value;
17 static struct sigaction act, oact;
19 #define NRNTIMEOUT_DEBUG 0
25 static void timed_out(
int sig) {
28 printf(
"timed_out(%d) wall_elapse=%g told=%g t=%g\n",
45 void nrn_timeout(
int seconds) {
55 act.sa_handler = timed_out;
56 act.sa_flags = SA_RESTART;
57 if (sigaction(SIGALRM, &act, &oact)) {
58 printf(
"sigaction failed\n");
62 sigaction(SIGALRM, &oact, (
struct sigaction*) 0);
64 value.it_interval.tv_sec = seconds;
65 value.it_interval.tv_usec = 0;
66 value.it_value.tv_sec = seconds;
67 value.it_value.tv_usec = 0;
68 if (setitimer(ITIMER_REAL, &
value, (
struct itimerval*) 0)) {
69 printf(
"setitimer failed\n");
76 void nrn_timeout(
int seconds) {}
void(* nrntimeout_call)()
void nrnmpi_abort(int errcode)