aboutsummaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2016-04-16 16:43:42 +0200
committerAndreas Eversberg <jolly@eversberg.eu>2016-04-17 16:49:08 +0200
commit05402283dfd4da630c254cd1e3852ac3900abd3e (patch)
treef94c0df3ae71075a497826f13393d06cf086e82b /src/common
parent21865b6f0fc36e9e6438a164d3e3d2e951ac1ba2 (diff)
common code: Add function request information, if timer is running
Diffstat (limited to 'src/common')
-rw-r--r--src/common/timer.c10
-rw-r--r--src/common/timer.h1
2 files changed, 11 insertions, 0 deletions
diff --git a/src/common/timer.c b/src/common/timer.c
index 4b07d13..d13414a 100644
--- a/src/common/timer.c
+++ b/src/common/timer.c
@@ -89,6 +89,16 @@ void timer_stop(struct timer *timer)
timer->timeout = 0;
}
+int timer_running(struct timer *timer)
+{
+ if (!timer->linked) {
+ fprintf(stderr, "Timer is not initialized, aborting!\n");
+ abort();
+ }
+
+ return (timer->timeout != 0);
+}
+
void process_timer(void)
{
struct timer *timer = timer_head;
diff --git a/src/common/timer.h b/src/common/timer.h
index 49136ab..2073a8f 100644
--- a/src/common/timer.h
+++ b/src/common/timer.h
@@ -13,5 +13,6 @@ void timer_init(struct timer *timer, void (*fn)(struct timer *timer), void *priv
void timer_exit(struct timer *timer);
void timer_start(struct timer *timer, double duration);
void timer_stop(struct timer *timer);
+int timer_running(struct timer *timer);
void process_timer(void);