]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Make all tasks to be bound to a thread
authorOndřej Surý <ondrej@isc.org>
Thu, 19 May 2022 09:20:21 +0000 (11:20 +0200)
committerOndřej Surý <ondrej@isc.org>
Wed, 25 May 2022 14:04:51 +0000 (16:04 +0200)
Previously, tasks could be created either unbound or bound to a specific
thread (worker loop).  The unbound tasks would be assigned to a random
thread every time isc_task_send() was called.  Because there's no logic
that would assign the task to the least busy worker, this just creates
unpredictability.  Instead of random assignment, bind all the previously
unbound tasks to worker 0, which is guaranteed to exist.

28 files changed:
bin/dig/dighost.c
bin/dnssec/dnssec-signzone.c
bin/named/server.c
bin/nsupdate/nsupdate.c
bin/rndc/rndc.c
bin/tests/system/pipelined/pipequeries.c
bin/tests/system/tkey/keycreate.c
bin/tests/system/tkey/keydelete.c
bin/tools/mdig.c
lib/dns/adb.c
lib/dns/cache.c
lib/dns/catz.c
lib/dns/client.c
lib/dns/nta.c
lib/dns/resolver.c
lib/dns/rpz.c
lib/dns/tests/dnstest.c
lib/dns/tests/keytable_test.c
lib/dns/view.c
lib/dns/zone.c
lib/isc/include/isc/task.h
lib/isc/task.c
lib/isc/tests/isctest.c
lib/isc/tests/task_test.c
lib/isc/tests/timer_test.c
lib/ns/client.c
lib/ns/interfacemgr.c
lib/ns/tests/nstest.c

index 2e3f2df5d8c02431a8cf829ac1b1c88e221ce13b..528098a077af7c488f5941beb417e67e895d6e13 100644 (file)
@@ -1392,7 +1392,7 @@ setup_libs(void) {
 
        isc_managers_create(mctx, 1, 0, &netmgr, &taskmgr, NULL);
 
-       result = isc_task_create(taskmgr, 0, &global_task);
+       result = isc_task_create(taskmgr, 0, &global_task, 0);
        check_result(result, "isc_task_create");
        isc_task_setname(global_task, "dig", NULL);
 
index 2a8e729821bd9b8775ed4b55c46673c2824afd7a..66abc6c002276af30407ba145a640cfd2d398079 100644 (file)
@@ -4001,7 +4001,7 @@ main(int argc, char *argv[]) {
        isc_managers_create(mctx, ntasks, 0, &netmgr, &taskmgr, NULL);
 
        main_task = NULL;
-       result = isc_task_create(taskmgr, 0, &main_task);
+       result = isc_task_create(taskmgr, 0, &main_task, 0);
        if (result != ISC_R_SUCCESS) {
                fatal("failed to create task: %s", isc_result_totext(result));
        }
@@ -4009,7 +4009,7 @@ main(int argc, char *argv[]) {
        tasks = isc_mem_get(mctx, ntasks * sizeof(isc_task_t *));
        for (i = 0; i < (int)ntasks; i++) {
                tasks[i] = NULL;
-               result = isc_task_create(taskmgr, 0, &tasks[i]);
+               result = isc_task_create(taskmgr, 0, &tasks[i], i);
                if (result != ISC_R_SUCCESS) {
                        fatal("failed to create task: %s",
                              isc_result_totext(result));
index 49ec7cb4f60d96638c42d0db8a4118136a23f60d..84cc98419a5cca002f10d81746ddc2a7c3041b92 100644 (file)
@@ -10067,7 +10067,7 @@ named_server_create(isc_mem_t *mctx, named_server_t **serverp) {
         * startup and shutdown of the server, as well as all exclusive
         * tasks.
         */
-       CHECKFATAL(isc_task_create_bound(named_g_taskmgr, 0, &server->task, 0),
+       CHECKFATAL(isc_task_create(named_g_taskmgr, 0, &server->task, 0),
                   "creating server task");
        isc_task_setname(server->task, "server", server);
        isc_taskmgr_setexcltask(named_g_taskmgr, server->task);
index 0982bd8a9853dcd155bb2b1899f7fd1179749e98..b57fe20bb2705e8a2b43695cb5d3934e9a130213 100644 (file)
@@ -911,7 +911,7 @@ setup_system(void) {
        result = dns_dispatchmgr_create(gmctx, netmgr, &dispatchmgr);
        check_result(result, "dns_dispatchmgr_create");
 
-       result = isc_task_create(taskmgr, 0, &global_task);
+       result = isc_task_create(taskmgr, 0, &global_task, 0);
        check_result(result, "isc_task_create");
 
        result = dst_lib_init(gmctx, NULL);
index b9fbd87f0c315229697516a480d65b0c6b5e7181..bd9afeac1a0081d7a8a7a57a95247f74e4fdc0e7 100644 (file)
@@ -1028,7 +1028,7 @@ main(int argc, char **argv) {
 
        isc_mem_create(&rndc_mctx);
        isc_managers_create(rndc_mctx, 1, 0, &netmgr, &taskmgr, NULL);
-       DO("create task", isc_task_create(taskmgr, 0, &rndc_task));
+       DO("create task", isc_task_create(taskmgr, 0, &rndc_task, 0));
        isc_log_create(rndc_mctx, &log, &logconfig);
        isc_log_setcontext(log);
        isc_log_settag(logconfig, progname);
index 83247564549221a16414fc02c60eb82a9912a78b..56938463875ef42254a10ffd4a4abd30542d62d3 100644 (file)
@@ -263,7 +263,7 @@ main(int argc, char *argv[]) {
        RUNCHECK(dst_lib_init(mctx, NULL));
 
        isc_managers_create(mctx, 1, 0, &netmgr, &taskmgr, NULL);
-       RUNCHECK(isc_task_create(taskmgr, 0, &task));
+       RUNCHECK(isc_task_create(taskmgr, 0, &task, 0));
        RUNCHECK(dns_dispatchmgr_create(mctx, netmgr, &dispatchmgr));
 
        RUNCHECK(dns_dispatch_createudp(
index d03dffc5d502884b301f15c839aba870272e7a91..83e0a385632ec6f2e97420dfc8a5213f03f5e61a 100644 (file)
@@ -223,7 +223,7 @@ main(int argc, char *argv[]) {
 
        isc_managers_create(mctx, 1, 0, &netmgr, &taskmgr, NULL);
 
-       RUNCHECK(isc_task_create(taskmgr, 0, &task));
+       RUNCHECK(isc_task_create(taskmgr, 0, &task, 0));
        RUNCHECK(dns_dispatchmgr_create(mctx, netmgr, &dispatchmgr));
 
        isc_sockaddr_any(&bind_any);
index 4d328655103a18676f3b59c79f366717d90b440d..bc9e18a7b5c1aa7bd10ff422d7eafcfa7d1b4722 100644 (file)
@@ -167,7 +167,7 @@ main(int argc, char **argv) {
 
        isc_managers_create(mctx, 1, 0, &netmgr, &taskmgr, NULL);
 
-       RUNCHECK(isc_task_create(taskmgr, 0, &task));
+       RUNCHECK(isc_task_create(taskmgr, 0, &task, 0));
        RUNCHECK(dns_dispatchmgr_create(mctx, netmgr, &dispatchmgr));
        isc_sockaddr_any(&bind_any);
        RUNCHECK(dns_dispatch_createudp(dispatchmgr, &bind_any, &dispatchv4));
index 725363d41c709a5a5e01a8082e1a7743da189d85..ad4139ffee35d986ae747ef2d746d2a811a736c0 100644 (file)
@@ -2157,7 +2157,7 @@ main(int argc, char *argv[]) {
        }
 
        isc_managers_create(mctx, 1, 0, &netmgr, &taskmgr, NULL);
-       RUNCHECK(isc_task_create(taskmgr, 0, &task));
+       RUNCHECK(isc_task_create(taskmgr, 0, &task, 0));
        RUNCHECK(dns_dispatchmgr_create(mctx, netmgr, &dispatchmgr));
 
        set_source_ports(dispatchmgr);
index 5c5d1d714eebb751411ad1b00c679f4eb21f19cf..cb9539a778ba382b2a5954a3cd40ceb51a654b75 100644 (file)
@@ -2126,7 +2126,7 @@ dns_adb_create(isc_mem_t *mem, dns_view_t *view, isc_taskmgr_t *taskmgr,
        /*
         * Allocate an internal task.
         */
-       result = isc_task_create(adb->taskmgr, 0, &adb->task);
+       result = isc_task_create(adb->taskmgr, 0, &adb->task, 0);
        if (result != ISC_R_SUCCESS) {
                goto free_lock;
        }
index c7fa21d94f723ab7d571b96dafed89c5ef28b6b4..011338e9977703a97678f7f9b3b94a12cfcb36a4 100644 (file)
@@ -258,7 +258,7 @@ dns_cache_create(isc_mem_t *cmctx, isc_mem_t *hmctx, isc_taskmgr_t *taskmgr,
        }
        if (taskmgr != NULL) {
                dbtask = NULL;
-               result = isc_task_create(taskmgr, 1, &dbtask);
+               result = isc_task_create(taskmgr, 1, &dbtask, 0);
                if (result != ISC_R_SUCCESS) {
                        goto cleanup_db;
                }
@@ -470,7 +470,7 @@ cache_cleaner_init(dns_cache_t *cache, isc_taskmgr_t *taskmgr,
        }
 
        if (taskmgr != NULL && timermgr != NULL) {
-               result = isc_task_create(taskmgr, 1, &cleaner->task);
+               result = isc_task_create(taskmgr, 1, &cleaner->task, 0);
                if (result != ISC_R_SUCCESS) {
                        UNEXPECTED_ERROR(__FILE__, __LINE__,
                                         "isc_task_create() failed: %s",
index e14880bfd0324413e7fbb6d6ce68ca91ab202c29..6007a1cab1de0423817b0a105365e224a4681824 100644 (file)
@@ -732,7 +732,7 @@ dns_catz_new_zones(dns_catz_zones_t **catzsp, dns_catz_zonemodmethods_t *zmm,
        new_zones->timermgr = timermgr;
        new_zones->taskmgr = taskmgr;
 
-       result = isc_task_create(taskmgr, 0, &new_zones->updater);
+       result = isc_task_create(taskmgr, 0, &new_zones->updater, 0);
        if (result != ISC_R_SUCCESS) {
                goto cleanup_ht;
        }
index 8f4d13939bf6964dff24673471d2d603df838993..675b78c8b3d1b8b2d5a4d6358ca98133f91563e1 100644 (file)
@@ -286,7 +286,7 @@ dns_client_create(isc_mem_t *mctx, isc_taskmgr_t *taskmgr, isc_nm_t *nm,
        isc_mutex_init(&client->readylock);
        isc_condition_init(&client->ready);
 
-       result = isc_task_create(client->taskmgr, 0, &client->task);
+       result = isc_task_create(client->taskmgr, 0, &client->task, 0);
        if (result != ISC_R_SUCCESS) {
                goto cleanup_lock;
        }
index c5d3d905a4d6eb329cf51e652517eb935e3e48a2..d6a2f61cf583bf05e7f79ca5a20eed192d4e6c0f 100644 (file)
@@ -111,7 +111,7 @@ dns_ntatable_create(dns_view_t *view, isc_taskmgr_t *taskmgr,
        ntatable = isc_mem_get(view->mctx, sizeof(*ntatable));
 
        ntatable->task = NULL;
-       result = isc_task_create(taskmgr, 0, &ntatable->task);
+       result = isc_task_create(taskmgr, 0, &ntatable->task, 0);
        if (result != ISC_R_SUCCESS) {
                goto cleanup_ntatable;
        }
index be1f9200bdd3c2150dec773e924dae924ea16988..08498c368d2b0a05ef586b4be3feb78186aae8ed 100644 (file)
@@ -10230,7 +10230,7 @@ dns_resolver_create(dns_view_t *view, isc_taskmgr_t *taskmgr,
                 * Since we have a pool of tasks we bind them to task
                 * queues to spread the load evenly
                 */
-               result = isc_task_create_bound(taskmgr, 0, &res->tasks[i], i);
+               result = isc_task_create(taskmgr, 0, &res->tasks[i], i);
                if (result != ISC_R_SUCCESS) {
                        goto cleanup_tasks;
                }
@@ -10260,7 +10260,7 @@ dns_resolver_create(dns_view_t *view, isc_taskmgr_t *taskmgr,
        isc_mutex_init(&res->lock);
        isc_mutex_init(&res->primelock);
 
-       result = isc_task_create(taskmgr, 0, &task);
+       result = isc_task_create(taskmgr, 0, &task, 0);
        if (result != ISC_R_SUCCESS) {
                goto cleanup_primelock;
        }
index d76bd53683d268333209fc6dd2f4c87cb9ae3d73..20632eefe9f3f3c53b3ea8a71e551ddbc1a43653 100644 (file)
@@ -1476,7 +1476,7 @@ dns_rpz_new_zones(dns_rpz_zones_t **rpzsp, char *rps_cstr, size_t rps_cstr_size,
                goto cleanup_rbt;
        }
 
-       result = isc_task_create(taskmgr, 0, &rpzs->updater);
+       result = isc_task_create(taskmgr, 0, &rpzs->updater, 0);
        if (result != ISC_R_SUCCESS) {
                goto cleanup_task;
        }
index 1ec9adfd1c18e6146fe1330f2d53cbca5d479267..5f01e10d45518fa20cc3f5b11145db03509e884d 100644 (file)
@@ -113,7 +113,7 @@ create_managers(void) {
        ncpus = isc_os_ncpus();
 
        isc_managers_create(dt_mctx, ncpus, 0, &netmgr, &taskmgr, &timermgr);
-       CHECK(isc_task_create(taskmgr, 0, &maintask));
+       CHECK(isc_task_create(taskmgr, 0, &maintask, 0));
        return (ISC_R_SUCCESS);
 
 cleanup:
index eaa375a12a0fd083c51259e3d27689b0b632d02f..e08f94effd744592cfc90537919e44e1b966fc4a 100644 (file)
@@ -603,7 +603,7 @@ nta_test(void **state) {
        result = dns_test_makeview("view", &myview);
        assert_int_equal(result, ISC_R_SUCCESS);
 
-       result = isc_task_create(taskmgr, 0, &myview->task);
+       result = isc_task_create(taskmgr, 0, &myview->task, 0);
        assert_int_equal(result, ISC_R_SUCCESS);
 
        result = dns_view_initsecroots(myview, dt_mctx);
index 4bb96aa5a6ac8f60a54d69b3ce87c5ad23da77fc..1669cd18a814009cf0a4b0585ac9b413583c98f7 100644 (file)
@@ -629,7 +629,7 @@ dns_view_createresolver(dns_view_t *view, isc_taskmgr_t *taskmgr,
        REQUIRE(!view->frozen);
        REQUIRE(view->resolver == NULL);
 
-       result = isc_task_create(taskmgr, 0, &view->task);
+       result = isc_task_create(taskmgr, 0, &view->task, 0);
        if (result != ISC_R_SUCCESS) {
                return (result);
        }
index c9ddc21498212c8c5f1889d6e95ef823df7f1b71..f9a758844214936da0fdf6124b3395a78cd3bc27 100644 (file)
@@ -18742,7 +18742,7 @@ dns_zonemgr_create(isc_mem_t *mctx, isc_taskmgr_t *taskmgr,
        isc_rwlock_init(&zmgr->urlock, 0, 0);
 
        /* Create a single task for queueing of SOA queries. */
-       result = isc_task_create(taskmgr, 1, &zmgr->task);
+       result = isc_task_create(taskmgr, 1, &zmgr->task, 0);
        if (result != ISC_R_SUCCESS) {
                goto free_urlock;
        }
@@ -18782,8 +18782,8 @@ dns_zonemgr_create(isc_mem_t *mctx, isc_taskmgr_t *taskmgr,
                zmgr->mctx, zmgr->workers * sizeof(zmgr->zonetasks[0]));
        memset(zmgr->zonetasks, 0, zmgr->workers * sizeof(zmgr->zonetasks[0]));
        for (size_t i = 0; i < zmgr->workers; i++) {
-               result = isc_task_create_bound(zmgr->taskmgr, 2,
-                                              &zmgr->zonetasks[i], i);
+               result = isc_task_create(zmgr->taskmgr, 2, &zmgr->zonetasks[i],
+                                        i);
                if (result != ISC_R_SUCCESS) {
                        goto free_zonetasks;
                }
@@ -18794,8 +18794,8 @@ dns_zonemgr_create(isc_mem_t *mctx, isc_taskmgr_t *taskmgr,
                zmgr->mctx, zmgr->workers * sizeof(zmgr->loadtasks[0]));
        memset(zmgr->loadtasks, 0, zmgr->workers * sizeof(zmgr->loadtasks[0]));
        for (size_t i = 0; i < zmgr->workers; i++) {
-               result = isc_task_create_bound(zmgr->taskmgr, UINT_MAX,
-                                              &zmgr->loadtasks[i], i);
+               result = isc_task_create(zmgr->taskmgr, UINT_MAX,
+                                        &zmgr->loadtasks[i], i);
                if (result != ISC_R_SUCCESS) {
                        goto free_loadtasks;
                }
index 703e7bff7f218cf9631590650cadd2997d2ec179..d91ea1b604e119b9e26c7d37a9ef1f9b6f1a92cb 100644 (file)
  * \section purge Purging and Unsending
  *
  * Events which have been queued for a task but not delivered may be removed
- * from the task's event queue by purging or unsending.
- *
- * With both types, the caller specifies a matching pattern that selects
- * events based upon their sender, type, and tag.
+ * from the task's event queue by purging the event.
  *
  * Purging calls isc_event_free() on the matching events.
  *
@@ -92,16 +89,14 @@ ISC_LANG_BEGINDECLS
  *** Types
  ***/
 
-#define isc_task_create(m, q, t) \
-       isc__task_create_bound(m, q, t, -1 ISC__TASKFILELINE)
-#define isc_task_create_bound(m, q, t, i) \
-       isc__task_create_bound(m, q, t, i ISC__TASKFILELINE)
+#define isc_task_create(m, q, t, i) \
+       isc__task_create(m, q, t, i ISC__TASKFILELINE)
 
 isc_result_t
-isc__task_create_bound(isc_taskmgr_t *manager, unsigned int quantum,
-                      isc_task_t **taskp, int tid ISC__TASKFLARG);
+isc__task_create(isc_taskmgr_t *manager, unsigned int quantum,
+                isc_task_t **taskp, int tid ISC__TASKFLARG);
 /*%<
- * Create a task, optionally bound to a particular tid.
+ * Create a task, bound to a particular thread id.
  *
  * Notes:
  *
@@ -127,7 +122,6 @@ isc__task_create_bound(isc_taskmgr_t *manager, unsigned int quantum,
  * Returns:
  *
  *\li   #ISC_R_SUCCESS
- *\li  #ISC_R_NOMEMORY
  *\li  #ISC_R_UNEXPECTED
  *\li  #ISC_R_SHUTTINGDOWN
  */
@@ -196,7 +190,7 @@ isc_task_detach(isc_task_t **taskp);
 void
 isc_task_send(isc_task_t *task, isc_event_t **eventp);
 /*%<
- * Send '*event' to 'task', if task is idle try starting it on cpu 'c'
+ * Send '*event' to 'task'.
  *
  * Requires:
  *
@@ -212,7 +206,7 @@ void
 isc_task_sendanddetach(isc_task_t **taskp, isc_event_t **eventp);
 /*%<
  * Send '*event' to '*taskp' and then detach '*taskp' from its
- * task. If task is idle try starting it on cpu 'c'
+ * task.
  *
  * Requires:
  *
@@ -239,15 +233,12 @@ isc_task_purgeevent(isc_task_t *task, isc_event_t *event);
 /*%<
  * Purge 'event' from a task's event queue.
  *
- * XXXRTH:  WARNING:  This method may be removed before beta.
- *
  * Notes:
  *
- *\li  If 'event' is on the task's event queue, it will be purged,
- *     unless it is marked as unpurgeable.  'event' does not have to be
- *     on the task's event queue; in fact, it can even be an invalid
- *     pointer.  Purging only occurs if the event is actually on the task's
- *     event queue.
+ *\li   If 'event' is on the task's event queue, it will be purged.  'event'
+ *      does not have to be on the task's event queue; in fact, it can even be
+ *     an invalid pointer.  Purging only occurs if the event is actually on the
+ *     task's event queue.
  *
  * \li Purging never changes the state of the task.
  *
@@ -262,8 +253,7 @@ isc_task_purgeevent(isc_task_t *task, isc_event_t *event);
  * Returns:
  *
  *\li  #true                   The event was purged.
- *\li  #false                  The event was not in the event queue,
- *                                     or was marked unpurgeable.
+ *\li  #false                  The event was not in the event queue.
  */
 
 void
@@ -295,8 +285,8 @@ isc_task_getname(isc_task_t *task);
  *
  * Returns:
  *\li  A non-NULL pointer to a null-terminated string.
- *     If the task has not been named, the string is
- *     empty.
+ *     If the task has not been named, the string is
+ *     empty.
  *
  */
 
index 75d42198c519e2b3b7bba6327aff7389fa87d0ae..248d871b57b64c78b1b08953a97ef401bf4a46a5 100644 (file)
@@ -58,7 +58,7 @@
  * locality on CPU.
  *
  * To make load even some tasks (from task pools) are bound to specific
- * queues using isc_task_create_bound. This way load balancing between
+ * queues using isc_task_create. This way load balancing between
  * CPUs/queues happens on the higher layer.
  */
 
@@ -118,7 +118,6 @@ struct isc_task {
        isc_time_t tnow;
        char name[16];
        void *tag;
-       bool bound;
        /* Protected by atomics */
        atomic_bool shuttingdown;
        /* Locked by task manager lock. */
@@ -198,18 +197,22 @@ task_destroy(isc_task_t *task) {
 }
 
 isc_result_t
-isc__task_create_bound(isc_taskmgr_t *manager, unsigned int quantum,
-                      isc_task_t **taskp, int tid ISC__TASKFLARG) {
+isc__task_create(isc_taskmgr_t *manager, unsigned int quantum,
+                isc_task_t **taskp, int tid ISC__TASKFLARG) {
        isc_task_t *task = NULL;
        bool exiting;
 
        REQUIRE(VALID_MANAGER(manager));
        REQUIRE(taskp != NULL && *taskp == NULL);
+       REQUIRE(tid >= 0 && tid < (int)manager->nworkers);
 
        XTRACE("isc_task_create");
 
        task = isc_mem_get(manager->mctx, sizeof(*task));
-       *task = (isc_task_t){ 0 };
+       *task = (isc_task_t){
+               .state = task_state_idle,
+               .tid = tid,
+       };
 
 #if TASKMGR_TRACE
        strlcpy(task->func, func, sizeof(task->func));
@@ -221,34 +224,14 @@ isc__task_create_bound(isc_taskmgr_t *manager, unsigned int quantum,
 
        isc_taskmgr_attach(manager, &task->manager);
 
-       if (tid == -1) {
-               /*
-                * Task is not pinned to a queue, it's tid will be
-                * randomly chosen when first task will be sent to it.
-                */
-               task->bound = false;
-               task->tid = -1;
-       } else {
-               /*
-                * Task is pinned to a queue, it'll always be run
-                * by a specific thread.
-                */
-               task->bound = true;
-               task->tid = tid % task->manager->nworkers;
-       }
-
        isc_mutex_init(&task->lock);
-       task->state = task_state_idle;
 
        isc_refcount_init(&task->references, 1);
        INIT_LIST(task->events);
-       task->nevents = 0;
        task->quantum = (quantum > 0) ? quantum : manager->default_quantum;
        atomic_init(&task->shuttingdown, false);
-       task->now = 0;
        isc_time_settoepoch(&task->tnow);
        memset(task->name, 0, sizeof(task->name));
-       task->tag = NULL;
        INIT_LINK(task, link);
        task->magic = TASK_MAGIC;
 
@@ -304,9 +287,6 @@ task_ready(isc_task_t *task) {
 
        isc_task_attach(task, &(isc_task_t *){ NULL });
        LOCK(&task->lock);
-       if (task->tid < 0) {
-               task->tid = (int)isc_random_uniform(manager->nworkers);
-       }
        isc_nm_task_enqueue(manager->netmgr, task, task->tid);
        UNLOCK(&task->lock);
 }
@@ -358,10 +338,6 @@ task_send(isc_task_t *task, isc_event_t **eventp) {
 
        if (task->state == task_state_idle) {
                was_idle = true;
-               if (!task->bound) {
-                       task->tid = (int)isc_random_uniform(
-                               task->manager->nworkers);
-               }
                INSIST(EMPTY(task->events));
                task->state = task_state_ready;
        }
@@ -438,11 +414,10 @@ isc_task_purgeevent(isc_task_t *task, isc_event_t *event) {
        REQUIRE(VALID_TASK(task));
 
        /*
-        * If 'event' is on the task's event queue, it will be purged,
-        * unless it is marked as unpurgeable.  'event' does not have to be
-        * on the task's event queue; in fact, it can even be an invalid
-        * pointer.  Purging only occurs if the event is actually on the task's
-        * event queue.
+        * If 'event' is on the task's event queue, it will be purged, 'event'
+        * does not have to be on the task's event queue; in fact, it can even
+        * be an invalid pointer.  Purging only occurs if the event is actually
+        * on the task's event queue.
         *
         * Purging never changes the state of the task.
         */
index ad8fa2ad60a30520da76df103d534d2f02a8d003..31690357c9571e0706c27fd2e576fd4d1285a419 100644 (file)
@@ -79,7 +79,7 @@ create_managers(unsigned int workers) {
        isc_managers_create(test_mctx, workers, 0, &netmgr, &taskmgr,
                            &timermgr);
 
-       CHECK(isc_task_create_bound(taskmgr, 0, &maintask, 0));
+       CHECK(isc_task_create(taskmgr, 0, &maintask, 0));
        isc_taskmgr_setexcltask(taskmgr, maintask);
 
        return (ISC_R_SUCCESS);
index b19fb9d98503a7674b6880a83e846a4ed7d5bf07..b06e7158af51c433c2c70263b9222e21c473ce34 100644 (file)
@@ -131,7 +131,7 @@ create_task(void **state) {
 
        UNUSED(state);
 
-       result = isc_task_create(taskmgr, 0, &task);
+       result = isc_task_create(taskmgr, 0, &task, 0);
        assert_int_equal(result, ISC_R_SUCCESS);
 
        isc_task_detach(&task);
@@ -153,7 +153,7 @@ all_events(void **state) {
        atomic_init(&a, 0);
        atomic_init(&b, 0);
 
-       result = isc_task_create(taskmgr, 0, &task);
+       result = isc_task_create(taskmgr, 0, &task, 0);
        assert_int_equal(result, ISC_R_SUCCESS);
 
        /* First event */
@@ -240,13 +240,13 @@ basic(void **state) {
 
        UNUSED(state);
 
-       result = isc_task_create(taskmgr, 0, &task1);
+       result = isc_task_create(taskmgr, 0, &task1, 0);
        assert_int_equal(result, ISC_R_SUCCESS);
-       result = isc_task_create(taskmgr, 0, &task2);
+       result = isc_task_create(taskmgr, 0, &task2, 0);
        assert_int_equal(result, ISC_R_SUCCESS);
-       result = isc_task_create(taskmgr, 0, &task3);
+       result = isc_task_create(taskmgr, 0, &task3, 0);
        assert_int_equal(result, ISC_R_SUCCESS);
-       result = isc_task_create(taskmgr, 0, &task4);
+       result = isc_task_create(taskmgr, 0, &task4, 0);
        assert_int_equal(result, ISC_R_SUCCESS);
 
        isc_interval_set(&interval, 1, 0);
@@ -365,13 +365,12 @@ task_exclusive(void **state) {
 
                if (i == 6) {
                        /* task chosen from the middle of the range */
-                       result = isc_task_create_bound(taskmgr, 0, &tasks[i],
-                                                      0);
+                       result = isc_task_create(taskmgr, 0, &tasks[i], 0);
                        assert_int_equal(result, ISC_R_SUCCESS);
 
                        isc_taskmgr_setexcltask(taskmgr, tasks[6]);
                } else {
-                       result = isc_task_create(taskmgr, 0, &tasks[i]);
+                       result = isc_task_create(taskmgr, 0, &tasks[i], 0);
                        assert_int_equal(result, ISC_R_SUCCESS);
                }
 
@@ -415,7 +414,7 @@ maxtask_cb(isc_task_t *task, isc_event_t *event) {
                /*
                 * Create a new task and forward the message.
                 */
-               result = isc_task_create(taskmgr, 0, &task);
+               result = isc_task_create(taskmgr, 0, &task, 0);
                assert_int_equal(result, ISC_R_SUCCESS);
 
                isc_task_send(task, &event);
@@ -513,7 +512,7 @@ try_purgeevent(void) {
        atomic_init(&done, false);
        eventcnt = 0;
 
-       result = isc_task_create(taskmgr, 0, &task);
+       result = isc_task_create(taskmgr, 0, &task, 0);
        assert_int_equal(result, ISC_R_SUCCESS);
 
        /*
index 685ce6973b3a74e2458f439df281bd501d8933e1..b91e0ac15f442e7207fe93bf9076403e2685fd12 100644 (file)
@@ -114,7 +114,7 @@ setup_test(isc_timertype_t timertype, isc_interval_t *interval,
 
        LOCK(&mx);
 
-       result = isc_task_create(taskmgr, 0, &task);
+       result = isc_task_create(taskmgr, 0, &task, 0);
        assert_int_equal(result, ISC_R_SUCCESS);
 
        isc_mutex_lock(&lasttime_mx);
@@ -493,10 +493,10 @@ purge(void **state) {
        seconds = 1;
        nanoseconds = 0;
 
-       result = isc_task_create(taskmgr, 0, &task1);
+       result = isc_task_create(taskmgr, 0, &task1, 0);
        assert_int_equal(result, ISC_R_SUCCESS);
 
-       result = isc_task_create(taskmgr, 0, &task2);
+       result = isc_task_create(taskmgr, 0, &task2, 0);
        assert_int_equal(result, ISC_R_SUCCESS);
 
        isc_interval_set(&interval, seconds, 0);
index edb89604a6fc954eb17da36041c6d69c554ed768..7596bb62e59cf2727f480a83d33e9362d6fcac58 100644 (file)
@@ -2436,8 +2436,8 @@ ns_clientmgr_create(ns_server_t *sctx, isc_taskmgr_t *taskmgr,
 
        dns_aclenv_attach(aclenv, &manager->aclenv);
 
-       result = isc_task_create_bound(manager->taskmgr, 20, &manager->task,
-                                      manager->tid);
+       result = isc_task_create(manager->taskmgr, 20, &manager->task,
+                                manager->tid);
        RUNTIME_CHECK(result == ISC_R_SUCCESS);
        isc_task_setname(manager->task, "clientmgr", NULL);
 
index 90268e94e433a921bcb94a0be1315f7b02c8abac..b399fe9f55b4e89fd34fed159b22c9d76a258030 100644 (file)
@@ -302,7 +302,7 @@ ns_interfacemgr_create(isc_mem_t *mctx, ns_server_t *sctx,
 
        isc_mutex_init(&mgr->lock);
 
-       result = isc_task_create_bound(taskmgr, 0, &mgr->task, 0);
+       result = isc_task_create(taskmgr, 0, &mgr->task, 0);
        if (result != ISC_R_SUCCESS) {
                goto cleanup_lock;
        }
index 076d01f77575d0a4d3166949bbce4fbd1dc71148..6afaed065f737df20ad21f0d8a7e9939567e8b48 100644 (file)
@@ -228,7 +228,7 @@ create_managers(void) {
        int ncpus = isc_os_ncpus();
 
        isc_managers_create(mctx, ncpus, 0, &netmgr, &taskmgr, &timermgr);
-       CHECK(isc_task_create_bound(taskmgr, 0, &maintask, 0));
+       CHECK(isc_task_create(taskmgr, 0, &maintask, 0));
        isc_taskmgr_setexcltask(taskmgr, maintask);
 
        CHECK(ns_server_create(mctx, matchview, &sctx));