/*
* Implement timeout with timer_create() and timer_settime().
*/
-static volatile int timeout_flag = FALSE;
-static timer_t timer_id;
-static int timer_created = FALSE;
+static volatile sig_atomic_t timeout_flag = FALSE;
+static timer_t timer_id;
+static int timer_created = FALSE;
/*
* Callback for when the timer expires.
* This function is not expected to fail, but if it does it will still return a
* valid flag pointer; the flag will remain stuck as FALSE .
*/
- volatile int *
+ volatile sig_atomic_t *
start_timeout(long msec)
{
struct itimerspec interval = {
}
}
-# else
+# else // HAVE_TIMER_CREATE
/*
* Implement timeout with setitimer()
*/
-static struct itimerval prev_interval;
-static struct sigaction prev_sigaction;
-static volatile int timeout_flag = FALSE;
-static int timer_active = FALSE;
-static int timer_handler_active = FALSE;
-static int alarm_pending = FALSE;
+static struct sigaction prev_sigaction;
+static volatile sig_atomic_t timeout_flag = FALSE;
+static int timer_active = FALSE;
+static int timer_handler_active = FALSE;
+static volatile sig_atomic_t alarm_pending = FALSE;
/*
* Handle SIGALRM for a timeout.
if (timer_active)
{
timer_active = FALSE;
- ret = setitimer(ITIMER_REAL, &disarm, &prev_interval);
+ ret = setitimer(ITIMER_REAL, &disarm, NULL);
if (ret < 0)
// Should only get here as a result of coding errors.
semsg(_(e_could_not_clear_timeout_str), strerror(errno));
semsg(_(e_could_not_reset_handler_for_timeout_str),
strerror(errno));
}
- timeout_flag = 0;
+ timeout_flag = FALSE;
}
/*
* This function is not expected to fail, but if it does it will still return a
* valid flag pointer; the flag will remain stuck as FALSE .
*/
- volatile int *
+ volatile sig_atomic_t *
start_timeout(long msec)
{
struct itimerval interval = {
timer_handler_active = TRUE;
// Set up the interval timer once the alarm handler is in place.
- ret = setitimer(ITIMER_REAL, &interval, &prev_interval);
+ ret = setitimer(ITIMER_REAL, &interval, NULL);
if (ret < 0)
{
// Should only get here as a result of coding errors.
* deleted. Ping-ponging between the two flags prevents this causing 'fake'
* timeouts.
*/
-static int timeout_flags[2];
-static int timeout_flag_idx = 0;
-static int *timeout_flag = &timeout_flags[0];
+static sig_atomic_t timeout_flags[2];
+static int timeout_flag_idx = 0;
+static sig_atomic_t *timeout_flag = &timeout_flags[0];
static void CALLBACK
* This function is not expected to fail, but if it does it still returns a
* valid flag pointer; the flag will remain stuck at zero.
*/
- volatile int *
+ volatile sig_atomic_t *
start_timeout(long msec)
{
BOOL ret;