Skip to content
Snippets Groups Projects
Commit e5732683 authored by Izzard, Robert Dr (Maths & Physics)'s avatar Izzard, Robert Dr (Maths & Physics)
Browse files

update timeout checks

parent 8efdc218
No related branches found
No related tags found
No related merge requests found
...@@ -19,19 +19,22 @@ ...@@ -19,19 +19,22 @@
void reset_binary_c_timeout(void) void reset_binary_c_timeout(void)
{ {
#ifndef __HAVE_SETITIMER__ #ifndef __HAVE_SETITIMER__
/* if(TIMEOUT_SECONDS != 0)
* We don't have setitimer but we do want a timeout: {
* exit with a warning. /*
*/ * We don't have setitimer but we do want a timeout:
Exit_binary_c_no_stardata(BINARY_C_TIMED_OUT, * exit with a warning.
"TIMEOUT_SECONDS is set to %ld but we have no access to setitimer to actually set the timeout. This will cause binary_c to not have a timeout, even though you have asked for it. Please set TIMEOUT_SECONDS to 0 in binary_c_code_options.h to fix this problem, or build on an operating system that supports setitimer.", */
(long int)TIMEOUT_SECONDS); Exit_binary_c_no_stardata(BINARY_C_TIMED_OUT,
"TIMEOUT_SECONDS is set to %ld but we have no access to setitimer to actually set the timeout. This will cause binary_c to not have a timeout, even though you have asked for it. Please set TIMEOUT_SECONDS to 0 in binary_c_code_options.h to fix this problem, or build on an operating system that supports setitimer.",
(long int)TIMEOUT_SECONDS);
}
#else #else
/* /*
* We have setitimer * We have setitimer, so if TIMEOUT_SECONDS is non-zero,
* set the timer.
*/ */
if(TIMEOUT_SECONDS) if(TIMEOUT_SECONDS != 0)
{ {
/* Timing */ /* Timing */
struct itimerval value; struct itimerval value;
...@@ -66,7 +69,11 @@ void reset_binary_c_timeout(void) ...@@ -66,7 +69,11 @@ void reset_binary_c_timeout(void)
void disable_binary_c_timeout(void) void disable_binary_c_timeout(void)
{ {
#ifdef __HAVE_SETITIMER__ #ifdef __HAVE_SETITIMER__
if(TIMEOUT_SECONDS) /*
* disable the timer if it could have been set (i.e. if
* TIMEOUT_SECONDS is non-zero)
*/
if(TIMEOUT_SECONDS != 0)
{ {
struct itimerval value; struct itimerval value;
struct timeval tv; struct timeval tv;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment