aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJ08nY2017-10-08 19:34:58 +0200
committerJ08nY2017-10-08 19:34:58 +0200
commit39aa16cf47e7b85b936f56a3256c1b547ed1bb68 (patch)
tree2b8407ef68564e095a4051953c8a041cdf11b585 /src
parent3997822941ebb377cc590b7c8c929eb334a470d6 (diff)
downloadecgen-39aa16cf47e7b85b936f56a3256c1b547ed1bb68.tar.gz
ecgen-39aa16cf47e7b85b936f56a3256c1b547ed1bb68.tar.zst
ecgen-39aa16cf47e7b85b936f56a3256c1b547ed1bb68.zip
Diffstat (limited to 'src')
-rw-r--r--src/util/timeout.c2
-rw-r--r--src/util/timeout.h18
2 files changed, 13 insertions, 7 deletions
diff --git a/src/util/timeout.c b/src/util/timeout.c
index c9608a9..fb3053d 100644
--- a/src/util/timeout.c
+++ b/src/util/timeout.c
@@ -17,7 +17,7 @@ void timeout_handle(int signum, siginfo_t *siginfo, void *other) {
if (timeout_in) siglongjmp(timeout_ptr, 1);
}
-bool timeout_init(const config_t *cfg) {
+bool timeout_init() {
struct sigaction new_action;
new_action.sa_sigaction = timeout_handle;
diff --git a/src/util/timeout.h b/src/util/timeout.h
index 7e4d6ce..29b837d 100644
--- a/src/util/timeout.h
+++ b/src/util/timeout.h
@@ -20,7 +20,14 @@ extern __thread bool timeout_in;
extern __thread timer_t timeout_timer;
/**
- * @brief
+ * @brief Start a timer that times out after <code>seconds-</code>.
+ *
+ * The timer is thread-local. This function is an if-like statement,
+ * it runs the <code>else</code> part for the duration of the timeout or
+ * until <code>timeout_stop</code> is called. If that branch times out, then the
+ * <code>if</code> part is run. The times should be always stopped by
+ * <code>timeout_stop</code> when the timed interval ends.
+ * @param seconds how long to run the <code>else</code> branch for
*/
#define timeout_start(seconds) \
if ((seconds) != 0) { \
@@ -39,7 +46,7 @@ extern __thread timer_t timeout_timer;
if ((seconds) != 0 && sigsetjmp(timeout_ptr, 1) == 1)
/**
- * @brief
+ * @brief Stop a timer.
*/
#define timeout_stop() \
{ \
@@ -50,10 +57,9 @@ extern __thread timer_t timeout_timer;
}
/**
- * @brief
- * @param cfg
- * @return
+ * @brief Initialize the timeout system.
+ * @return whether the initalization was successful
*/
-bool timeout_init(const config_t *cfg);
+bool timeout_init();
#endif // ECGEN_TIMEOUT_H