diff --git a/lib/isc/lib.c b/lib/isc/lib.c index db3918a5e2..bdff8efd35 100644 --- a/lib/isc/lib.c +++ b/lib/isc/lib.c @@ -49,7 +49,6 @@ isc__lib_initialize(void) { } rcu_register_thread(); - isc__thread_initialize(); isc__os_initialize(); isc__mutex_initialize(); isc__mem_initialize(); @@ -76,7 +75,6 @@ isc__lib_shutdown(void) { isc__mem_shutdown(); isc__mutex_shutdown(); isc__os_shutdown(); - isc__thread_shutdown(); /* should be after isc__mem_shutdown() which calls rcu_barrier() */ rcu_unregister_thread(); } diff --git a/lib/isc/loop.c b/lib/isc/loop.c index c1f2b540b5..1c7cacb202 100644 --- a/lib/isc/loop.c +++ b/lib/isc/loop.c @@ -40,6 +40,7 @@ #include "async_p.h" #include "job_p.h" #include "loop_p.h" +#include "thread_p.h" /** * Private @@ -497,6 +498,8 @@ isc_loopmgr_run(isc_loopmgr_t *loopmgr) { */ ignore_signal(SIGPIPE, SIG_IGN); + isc__thread_initialize(); + /* * The thread 0 is this one. */ @@ -619,6 +622,8 @@ isc_loopmgr_destroy(isc_loopmgr_t **loopmgrp) { isc_barrier_destroy(&loopmgr->pausing); isc_mem_putanddetach(&loopmgr->mctx, loopmgr, sizeof(*loopmgr)); + + isc__thread_shutdown(); } uint32_t