]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Taskmgr shutdown fixes
authorWitold Kręcicki <wpk@isc.org>
Thu, 18 Oct 2018 18:16:25 +0000 (18:16 +0000)
committerWitold Kręcicki <wpk@isc.org>
Wed, 24 Oct 2018 07:06:57 +0000 (07:06 +0000)
lib/isc/task.c

index 0338e0f74391ddb0676aa9a51aaa36089bf9e036..e8d2fc711cf78ae00ab0192f9132ed3225ea6094 100644 (file)
@@ -1180,6 +1180,15 @@ dispatch(isc__taskmgr_t *manager, int threadid) {
                }
        }
        UNLOCK(manager->locks[queue]);
+       /*
+        * There might be other dispatchers waiting on empty tasks,
+        * wake them up.
+        */
+       for (unsigned i=0; i < manager->workers; i++) {
+               LOCK(manager->locks[i]);
+               BROADCAST(&manager->work_available[i]);
+               UNLOCK(manager->locks[i]);
+       }
 }
 
 typedef struct st {
@@ -1421,8 +1430,10 @@ isc_taskmgr_destroy(isc_taskmgr_t **managerp) {
             task != NULL;
             task = NEXT(task, link)) {
                LOCK(&task->lock);
-               if (task_shutdown(task))
-                       push_readyq(manager, task, 0);
+               if (task_shutdown(task)) {
+                       int queue = task->threadid % manager->queues;
+                       push_readyq(manager, task, queue);
+               }
                UNLOCK(&task->lock);
        }
        /*