Skip to content

Commit 77e06c9

Browse files
authored
Use alarm() in timer_delete.c only if it's available
1 parent c1108b8 commit 77e06c9

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

lib/timer_delete.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
int timer_delete(timer_t timerid CK_ATTRIBUTE_UNUSED)
2424
{
25-
#ifdef HAVE_SETITIMER
25+
#if defined(HAVE_SETITIMER)
2626
/*
2727
* If the system does not have timer_settime() but does have
2828
* setitimer() use that instead of alarm().
@@ -38,7 +38,7 @@ int timer_delete(timer_t timerid CK_ATTRIBUTE_UNUSED)
3838
interval.it_interval.tv_usec = 0;
3939

4040
return setitimer(ITIMER_REAL, &interval, NULL);
41-
#else
41+
#elif defined(HAVE_ALARM)
4242
/*
4343
* There is only one timer, that used by alarm.
4444
* Setting alarm(0) will not set a new alarm, and
@@ -48,5 +48,10 @@ int timer_delete(timer_t timerid CK_ATTRIBUTE_UNUSED)
4848
alarm(0);
4949

5050
return 0;
51+
#else
52+
/*
53+
* There is no support for alternative timers, so there is nothing
54+
* to delete or reset.
55+
*/
5156
#endif
5257
}

0 commit comments

Comments
 (0)