aboutsummaryrefslogtreecommitdiff
path: root/support/support.h
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2021-06-16 13:44:03 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2021-06-22 12:09:52 -0300
commit92f7b465101c23e45f66c6ad25ba243df49556a0 (patch)
tree8af981c64cf0a77245f7bf1db86af48a44f5ca75 /support/support.h
parent52a5fe70a2c77935afe807fb6e904e512ddd894e (diff)
downloadglibc-92f7b465101c23e45f66c6ad25ba243df49556a0.zip
glibc-92f7b465101c23e45f66c6ad25ba243df49556a0.tar.gz
glibc-92f7b465101c23e45f66c6ad25ba243df49556a0.tar.bz2
support: Add support_create_timer
It is a simple wrapper over timer_create, timer_settime, and sigaction. It will be used to check for large timeout to trigger an EINTR and to avoid use a large timeout (as for alarm()). Reviewed-by: Lukasz Majewski <lukma@denx.de>
Diffstat (limited to 'support/support.h')
-rw-r--r--support/support.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/support/support.h b/support/support.h
index 874204b..9ec8ecb 100644
--- a/support/support.h
+++ b/support/support.h
@@ -24,6 +24,7 @@
#define SUPPORT_H
#include <stdbool.h>
+#include <stdint.h>
#include <stddef.h>
#include <sys/cdefs.h>
/* For mode_t. */
@@ -153,6 +154,16 @@ extern bool support_select_modifies_timeout (void);
tv_usec larger than 1000000. */
extern bool support_select_normalizes_timeout (void);
+/* Create a timer that trigger after SEC seconds and NSEC nanoseconds. If
+ REPEAT is true the timer will repeat indefinitely. If CALLBACK is not
+ NULL, the function will be called when the timer expires; otherwise a
+ dummy empty function is used instead.
+ This is implemented with POSIX per-process timer with SIGEV_SIGNAL. */
+timer_t support_create_timer (uint64_t sec, long int nsec, bool repeat,
+ void (*callback)(int));
+/* Disable the timer TIMER. */
+void support_delete_timer (timer_t timer);
+
__END_DECLS
#endif /* SUPPORT_H */