2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 14:07:59 +00:00

Merge branch 'ondrej/fix-missing-isc_taskmgr_detach-on-exiting' into 'main'

Add isc_taskmgr_detach when task is created while shutting down

See merge request isc-projects/bind9!5006
This commit is contained in:
Ondřej Surý 2021-05-10 11:33:46 +00:00
commit d3ebd19e23
2 changed files with 9 additions and 4 deletions

View File

@ -644,7 +644,7 @@ isc_task_privileged(isc_task_t *task);
void
isc_taskmgr_attach(isc_taskmgr_t *, isc_taskmgr_t **);
void
isc_taskmgr_detach(isc_taskmgr_t *);
isc_taskmgr_detach(isc_taskmgr_t **);
/*%<
* Attach/detach the task manager.
*/

View File

@ -193,7 +193,7 @@ task_finished(isc_task_t *task) {
task->magic = 0;
isc_mem_put(mctx, task, sizeof(*task));
isc_taskmgr_detach(manager);
isc_taskmgr_detach(&manager);
}
isc_result_t
@ -265,6 +265,7 @@ isc_task_create_bound(isc_taskmgr_t *manager, unsigned int quantum,
if (exiting) {
isc_mutex_destroy(&task->lock);
isc_taskmgr_detach(&task->manager);
isc_mem_put(manager->mctx, task, sizeof(*task));
return (ISC_R_SHUTTINGDOWN);
}
@ -959,8 +960,12 @@ isc_taskmgr_attach(isc_taskmgr_t *source, isc_taskmgr_t **targetp) {
}
void
isc_taskmgr_detach(isc_taskmgr_t *manager) {
REQUIRE(VALID_MANAGER(manager));
isc_taskmgr_detach(isc_taskmgr_t **managerp) {
REQUIRE(managerp != NULL);
REQUIRE(VALID_MANAGER(*managerp));
isc_taskmgr_t *manager = *managerp;
*managerp = NULL;
if (isc_refcount_decrement(&manager->references) == 1) {
manager_free(manager);