summaryrefslogtreecommitdiffstats
path: root/src/task.h
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2015-11-18 01:23:21 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2015-11-18 01:23:21 +0100
commit16e2b0213b54991d9f493d4c0ee7efca18436427 (patch)
tree9a94d449dbefd95709e0c8993b9963e3ece88239 /src/task.h
parent5082b5a4d2ec52b90e6d7ed178e462a6f0ff6f3e (diff)
downloadfastd-16e2b0213b54991d9f493d4c0ee7efca18436427.tar
fastd-16e2b0213b54991d9f493d4c0ee7efca18436427.zip
Clean up peer task handling
Diffstat (limited to 'src/task.h')
-rw-r--r--src/task.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/task.h b/src/task.h
index 91bacc0..667386a 100644
--- a/src/task.h
+++ b/src/task.h
@@ -44,6 +44,7 @@ struct fastd_task {
void fastd_task_handle(void);
void fastd_task_reschedule(fastd_task_t *task, fastd_timeout_t timeout);
+fastd_timeout_t fastd_task_queue_timeout(void);
/** Checks if the given task is currently scheduled */
@@ -51,6 +52,14 @@ static inline bool fastd_task_scheduled(fastd_task_t *task) {
return fastd_pqueue_linked(&task->entry);
}
+/** Gets the timeout of a task */
+static inline fastd_timeout_t fastd_task_timeout(fastd_task_t *task) {
+ if (!fastd_task_scheduled(task))
+ return fastd_timeout_inv;
+
+ return task->entry.value;
+}
+
/** Removes a task from the queue */
static inline void fastd_task_unschedule(fastd_task_t *task) {
fastd_pqueue_remove(&task->entry);
@@ -66,6 +75,3 @@ static inline void fastd_task_schedule(fastd_task_t *task, fastd_task_type_t typ
task->type = type;
fastd_task_reschedule(task, timeout);
}
-
-
-bool fastd_task_timeout(fastd_timeout_t *timeout);