From f6f0613b47ff731ad8c65ec90d12e643d3e27c55 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Thu, 10 Oct 2024 10:24:27 -0400 Subject: tests/sighook: Use the new xtimer_start() API --- tests/sighook.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'tests') diff --git a/tests/sighook.c b/tests/sighook.c index aa01c36..d785a55 100644 --- a/tests/sighook.c +++ b/tests/sighook.c @@ -4,14 +4,14 @@ #include "tests.h" #include "atomic.h" -#include "thread.h" #include "sighook.h" +#include "thread.h" +#include "xtime.h" #include #include #include #include -#include /** Counts SIGALRM deliveries. */ static atomic size_t count = 0; @@ -61,10 +61,9 @@ void check_sighook(void) { } // Create a timer that sends SIGALRM every 100 microseconds - struct itimerval ival = {0}; - ival.it_value.tv_usec = 100; - ival.it_interval.tv_usec = 100; - if (!bfs_echeck(setitimer(ITIMER_REAL, &ival, NULL) == 0)) { + struct timespec ival = { .tv_nsec = 100 * 1000 }; + struct timer *timer = xtimer_start(&ival); + if (!bfs_echeck(timer)) { goto unhook; } @@ -104,8 +103,7 @@ void check_sighook(void) { bfs_echeck(errno == 0, "pthread_sigmask()"); untime: // Stop the timer - ival.it_value.tv_usec = 0; - bfs_echeck(setitimer(ITIMER_REAL, &ival, NULL) == 0); + xtimer_stop(timer); unhook: // Unregister the SIGALRM hook sigunhook(hook); -- cgit v1.2.3