]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: tasks: Allow tasklet_wakeup() to wakeup a task.
authorOlivier Houchard <ohouchard@haproxy.com>
Wed, 1 Aug 2018 13:58:44 +0000 (15:58 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 16 Aug 2018 15:29:53 +0000 (17:29 +0200)
Modify tasklet_wakeup() so that it handles a task as well, and inserts it
directly into the tasklet list, making it effectively a tasklet.
This should make future developments easier.

include/proto/task.h

index cb3f9af43fd9d2ac4bc82fc20eae3e4785dfcdd1..13398c53e11ddc332dda3b0f50427982e38d343a 100644 (file)
@@ -106,6 +106,9 @@ extern int task_list_size[MAX_THREADS]; /* Number of task sin the task_list */
 __decl_hathreads(extern HA_SPINLOCK_T rq_lock);  /* spin lock related to run queue */
 __decl_hathreads(extern HA_SPINLOCK_T wq_lock);  /* spin lock related to wait queue */
 
+
+static inline void task_insert_into_tasklet_list(struct task *t);
+
 /* return 0 if task is in run queue, otherwise non-zero */
 static inline int task_in_rq(struct task *t)
 {
@@ -215,6 +218,10 @@ static inline struct task *task_unlink_rq(struct task *t)
 
 static inline void tasklet_wakeup(struct tasklet *tl)
 {
+       if (!TASK_IS_TASKLET(tl)) {
+               task_insert_into_tasklet_list((struct task *)tl);
+               return;
+       }
        if (!LIST_ISEMPTY(&tl->list))
                return;
        LIST_ADDQ(&task_list[tid], &tl->list);