runqueue_task_cancel(t, t->cancel_type);
}
-void runqueue_task_add(struct runqueue *q, struct runqueue_task *t, bool running)
+static void _runqueue_task_add(struct runqueue *q, struct runqueue_task *t, bool running, bool first)
{
struct safe_list *head;
t->timeout.cb = __runqueue_task_timeout;
t->q = q;
- safe_list_add(&t->list, head);
+ if (first)
+ safe_list_add_first(&t->list, head);
+ else
+ safe_list_add(&t->list, head);
t->cancelled = false;
t->queued = true;
t->running = running;
runqueue_start_next(q);
}
+void runqueue_task_add(struct runqueue *q, struct runqueue_task *t, bool running)
+{
+ _runqueue_task_add(q, t, running, 0);
+}
+
+void runqueue_task_add_first(struct runqueue *q, struct runqueue_task *t, bool running)
+{
+ _runqueue_task_add(q, t, running, 1);
+}
+
void runqueue_task_kill(struct runqueue_task *t)
{
struct runqueue *q = t->q;
void runqueue_resume(struct runqueue *q);
void runqueue_task_add(struct runqueue *q, struct runqueue_task *t, bool running);
+void runqueue_task_add_first(struct runqueue *q, struct runqueue_task *t, bool running);
void runqueue_task_complete(struct runqueue_task *t);
void runqueue_task_cancel(struct runqueue_task *t, int type);
list_add_tail(&list->list, &head->list);
}
+void safe_list_add_first(struct safe_list *list, struct safe_list *head)
+{
+ list->i = NULL;
+ list_add(&list->list, &head->list);
+}
+
void safe_list_del(struct safe_list *list)
{
struct safe_list_iterator *i, *next_i, **tail;
void *ctx);
void safe_list_add(struct safe_list *list, struct safe_list *head);
+void safe_list_add_first(struct safe_list *list, struct safe_list *head);
void safe_list_del(struct safe_list *list);
#define INIT_SAFE_LIST(_head) \