1999-06-23 18:28:27 -04:00
|
|
|
/*
|
2015-05-23 08:21:51 -04:00
|
|
|
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
1999-06-23 18:28:27 -04:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
2021-06-03 02:37:05 -04:00
|
|
|
*
|
1999-06-23 18:28:27 -04:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
|
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
2018-02-23 03:53:12 -05:00
|
|
|
*
|
1999-06-23 18:28:27 -04:00
|
|
|
* See the COPYRIGHT file distributed with this work for additional
|
|
|
|
|
* information regarding copyright ownership.
|
|
|
|
|
*/
|
|
|
|
|
|
2005-04-27 00:57:32 -04:00
|
|
|
/*! \file */
|
2000-06-22 18:00:42 -04:00
|
|
|
|
2024-08-08 06:16:50 -04:00
|
|
|
#include <isc/crypto.h>
|
2023-09-08 11:48:45 -04:00
|
|
|
#include <isc/hash.h>
|
2023-01-16 05:12:06 -05:00
|
|
|
#include <isc/iterated_hash.h>
|
2023-01-16 03:16:35 -05:00
|
|
|
#include <isc/md.h>
|
2021-02-09 11:44:40 -05:00
|
|
|
#include <isc/mem.h>
|
2021-07-12 08:21:21 -04:00
|
|
|
#include <isc/os.h>
|
2025-02-04 07:17:31 -05:00
|
|
|
#include <isc/refcount.h>
|
2021-02-09 11:44:40 -05:00
|
|
|
#include <isc/tls.h>
|
2023-05-15 06:42:33 -04:00
|
|
|
#include <isc/urcu.h>
|
2021-02-09 11:44:40 -05:00
|
|
|
#include <isc/util.h>
|
2022-09-23 07:54:33 -04:00
|
|
|
#include <isc/uv.h>
|
2022-09-23 08:36:54 -04:00
|
|
|
#include <isc/xml.h>
|
2021-02-09 11:44:40 -05:00
|
|
|
|
|
|
|
|
#include "mem_p.h"
|
2022-07-13 07:19:32 -04:00
|
|
|
#include "mutex_p.h"
|
2021-12-14 15:49:53 -05:00
|
|
|
#include "os_p.h"
|
2025-02-04 13:17:28 -05:00
|
|
|
#include "thread_p.h"
|
1999-06-23 18:28:27 -04:00
|
|
|
|
|
|
|
|
/***
|
|
|
|
|
*** Functions
|
|
|
|
|
***/
|
|
|
|
|
|
2025-02-04 07:17:31 -05:00
|
|
|
static isc_refcount_t isc__lib_references = 0;
|
|
|
|
|
|
2021-02-09 11:44:40 -05:00
|
|
|
void
|
2025-02-04 07:17:31 -05:00
|
|
|
isc__lib_initialize(void);
|
2021-02-09 11:44:40 -05:00
|
|
|
void
|
2025-02-04 07:17:31 -05:00
|
|
|
isc__lib_shutdown(void);
|
2021-02-09 11:44:40 -05:00
|
|
|
|
|
|
|
|
void
|
2025-02-04 07:17:31 -05:00
|
|
|
isc__lib_initialize(void) {
|
|
|
|
|
if (isc_refcount_increment0(&isc__lib_references) > 0) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
rcu_register_thread();
|
2025-02-04 13:17:28 -05:00
|
|
|
isc__thread_initialize();
|
2021-12-14 15:49:53 -05:00
|
|
|
isc__os_initialize();
|
2022-07-13 07:19:32 -04:00
|
|
|
isc__mutex_initialize();
|
2021-02-09 11:44:40 -05:00
|
|
|
isc__mem_initialize();
|
2024-08-13 08:46:42 -04:00
|
|
|
isc__log_initialize();
|
2024-08-08 06:16:50 -04:00
|
|
|
isc__crypto_initialize();
|
2022-09-23 07:54:33 -04:00
|
|
|
isc__uv_initialize();
|
2022-09-23 08:36:54 -04:00
|
|
|
isc__xml_initialize();
|
2023-09-08 11:48:45 -04:00
|
|
|
isc__hash_initialize();
|
2023-01-16 05:12:06 -05:00
|
|
|
isc__iterated_hash_initialize();
|
2021-07-12 08:21:21 -04:00
|
|
|
(void)isc_os_ncpus();
|
2021-02-09 11:44:40 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2025-02-04 07:17:31 -05:00
|
|
|
isc__lib_shutdown(void) {
|
|
|
|
|
if (isc_refcount_decrement(&isc__lib_references) > 1) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-16 05:12:06 -05:00
|
|
|
isc__iterated_hash_shutdown();
|
2022-09-23 08:36:54 -04:00
|
|
|
isc__xml_shutdown();
|
2022-09-23 07:54:33 -04:00
|
|
|
isc__uv_shutdown();
|
2024-08-08 06:16:50 -04:00
|
|
|
isc__crypto_shutdown();
|
2024-08-13 08:46:42 -04:00
|
|
|
isc__log_shutdown();
|
2021-02-09 11:44:40 -05:00
|
|
|
isc__mem_shutdown();
|
2022-07-13 07:19:32 -04:00
|
|
|
isc__mutex_shutdown();
|
2021-12-14 15:49:53 -05:00
|
|
|
isc__os_shutdown();
|
2025-02-04 13:17:28 -05:00
|
|
|
isc__thread_shutdown();
|
2023-05-15 06:42:33 -04:00
|
|
|
/* should be after isc__mem_shutdown() which calls rcu_barrier() */
|
|
|
|
|
rcu_unregister_thread();
|
2021-02-09 11:44:40 -05:00
|
|
|
}
|