]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Post shutting down tasks always to manager 0
authorWitold Kręcicki <wpk@isc.org>
Mon, 22 Oct 2018 12:26:27 +0000 (12:26 +0000)
committerWitold Kręcicki <wpk@isc.org>
Wed, 24 Oct 2018 07:06:57 +0000 (07:06 +0000)
lib/isc/task.c

index d36143d32a187fad61c804de579f910244aaf50c..9c1f769b8b3a56f115c89e7e043f3fe08c377df9 100644 (file)
@@ -1391,17 +1391,21 @@ isc_taskmgr_destroy(isc_taskmgr_t **managerp) {
 
        /*
         * Post shutdown event(s) to every task (if they haven't already been
-        * posted).
+        * posted). To make things easier post idle tasks to worker 0.
         */
+       LOCK(&manager->queues[0].lock);
        for (task = HEAD(manager->tasks);
             task != NULL;
             task = NEXT(task, link)) {
                LOCK(&task->lock);
                if (task_shutdown(task)) {
-                       push_readyq(manager, task, task->threadid);
+                       task->threadid = 0;
+                       push_readyq(manager, task, 0);
                }
                UNLOCK(&task->lock);
        }
+       UNLOCK(&manager->queues[0].lock);
+
        /*
         * Wake up any sleeping workers.  This ensures we get work done if
         * there's work left to do, and if there are already no tasks left