summaryrefslogtreecommitdiff
path: root/test/test.c
diff options
context:
space:
mode:
authorAlfred E. Heggestad <aeh@db.org>2016-02-14 12:42:14 +0100
committerAlfred E. Heggestad <aeh@db.org>2016-02-14 12:42:14 +0100
commitbcc02dc4019b6d4afd744bc06e6764687a7af8b5 (patch)
tree51bf3253694c5058b252e5d29cd801f2edb431f9 /test/test.c
parent7c8862398d184d8735b718145a75bb0dd5e650f0 (diff)
test: use milliseconds for re_main_timeout value
Diffstat (limited to 'test/test.c')
-rw-r--r--test/test.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/test/test.c b/test/test.c
index ec6f6fb..59e1cd1 100644
--- a/test/test.c
+++ b/test/test.c
@@ -15,15 +15,22 @@ static void timeout_handler(void *arg)
}
-int re_main_timeout(uint32_t timeout)
+static void signal_handler(int sig)
+{
+ re_fprintf(stderr, "test interrupted by signal %d\n", sig);
+ re_cancel();
+}
+
+
+int re_main_timeout(uint32_t timeout_ms)
{
struct tmr tmr;
int err = 0;
tmr_init(&tmr);
- tmr_start(&tmr, timeout * 1000, timeout_handler, &err);
- re_main(NULL);
+ tmr_start(&tmr, timeout_ms, timeout_handler, &err);
+ re_main(signal_handler);
tmr_cancel(&tmr);
return err;