MINOR: tasks: pass the queue index to run_task_from_list()

Instead of passing it a pointer to the queue, pass it the queue's index
so that it can perform all the work around current_queue and tl_class_mask.
diff --git a/include/haproxy/task.h b/include/haproxy/task.h
index 3a56acd..335baf9 100644
--- a/include/haproxy/task.h
+++ b/include/haproxy/task.h
@@ -116,7 +116,7 @@
                                    struct task *(*fct)(struct task *, void *, unsigned short),
                                    void *arg);
 void work_list_destroy(struct work_list *work, int nbthread);
-int run_tasks_from_list(struct list *list, int max);
+int run_tasks_from_list(unsigned int queue, int max);
 
 /*
  * This does 3 things :
diff --git a/src/task.c b/src/task.c
index d6bda26..65d29c3 100644
--- a/src/task.c
+++ b/src/task.c
@@ -318,20 +318,31 @@
 	return ret;
 }
 
-/* Walks over tasklet list <list> and run at most <max> of them. Returns
- * the number of entries effectively processed (tasks and tasklets merged).
- * The count of tasks in the list for the current thread is adjusted.
+/* Walks over tasklet list sched->tasklets[queue] and run at most <max> of
+ * them. Returns the number of entries effectively processed (tasks and
+ * tasklets merged). The count of tasks in the list for the current thread
+ * is adjusted.
  */
-int run_tasks_from_list(struct list *list, int max)
+int run_tasks_from_list(unsigned int queue, int max)
 {
 	struct task *(*process)(struct task *t, void *ctx, unsigned short state);
+	struct list *tl_queues = sched->tasklets;
 	struct task *t;
 	unsigned short state;
 	void *ctx;
 	int done = 0;
 
-	while (done < max && !LIST_ISEMPTY(list)) {
-		t = (struct task *)LIST_ELEM(list->n, struct tasklet *, list);
+	sched->current_queue = queue;
+	while (1) {
+		if (LIST_ISEMPTY(&tl_queues[queue])) {
+			sched->tl_class_mask &= ~(1 << queue);
+			break;
+		}
+
+		if (done >= max)
+			break;
+
+		t = (struct task *)LIST_ELEM(tl_queues[queue].n, struct tasklet *, list);
 		state = (t->state & (TASK_SHARED_WQ|TASK_SELF_WAKING));
 
 		ti->flags &= ~TI_FL_STUCK; // this thread is still running
@@ -400,6 +411,7 @@
 		}
 		done++;
 	}
+	sched->current_queue = -1;
 
 	return done;
 }
@@ -553,13 +565,8 @@
 
 	/* execute tasklets in each queue */
 	for (queue = 0; queue < TL_CLASSES; queue++) {
-		if (max[queue] > 0) {
-			tt->current_queue = queue;
-			max_processed -= run_tasks_from_list(&tt->tasklets[queue], max[queue]);
-			tt->current_queue = -1;
-			if (LIST_ISEMPTY(&tt->tasklets[queue]))
-				tt->tl_class_mask &= ~(1 << queue);
-		}
+		if (max[queue] > 0)
+			max_processed -= run_tasks_from_list(queue, max[queue]);
 	}
 
 	/* some tasks may have woken other ones up */