libubox: add static initializer macro for runqueues
authorFelix Fietkau <nbd@nbd.name>
Fri, 29 Jul 2016 10:00:15 +0000 (12:00 +0200)
committerFelix Fietkau <nbd@nbd.name>
Fri, 29 Jul 2016 10:01:37 +0000 (12:01 +0200)
Signed-off-by: Felix Fietkau <nbd@nbd.name>
runqueue.h

index 0d4173dbf54501c4413ef6cfeea10ec865373113..f182e4e347ac37f13b5c5767831ee80c5fbbaacb 100644 (file)
@@ -90,6 +90,15 @@ struct runqueue_process {
        struct uloop_process proc;
 };
 
+#define RUNQUEUE_INIT(_name, _max_running) { \
+               .tasks_active = SAFE_LIST_INIT(_name.tasks_active), \
+               .tasks_inactive = SAFE_LIST_INIT(_name.tasks_inactive), \
+               .max_running_tasks = _max_running \
+       }
+
+#define RUNQUEUE(_name, _max_running) \
+       struct runqueue _name = RUNQUEUE_INIT(_name, _max_running)
+
 void runqueue_init(struct runqueue *q);
 void runqueue_cancel(struct runqueue *q);
 void runqueue_cancel_active(struct runqueue *q);