diff options
| -rw-r--r-- | src/util/timeout.c | 2 | ||||
| -rw-r--r-- | src/util/timeout.h | 18 |
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 |
