2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00

REQUIRE should not have side effects

it's a style violation to have REQUIRE or INSIST contain code that
must run for the server to work. this was being done with some
atomic_compare_exchange calls. these have been cleaned up.  uses
of atomic_compare_exchange in assertions have been replaced with
a new macro atomic_compare_exchange_enforced, which uses RUNTIME_CHECK
to ensure that the exchange was successful.
This commit is contained in:
Evan Hunt
2021-10-21 02:28:48 -07:00
parent 7e49c5e38a
commit a499794984
12 changed files with 80 additions and 55 deletions

View File

@@ -128,8 +128,7 @@ tls_initialize(void) {
"seeded' message in the OpenSSL FAQ)");
}
REQUIRE(atomic_compare_exchange_strong(&init_done, &(bool){ false },
true));
atomic_compare_exchange_enforced(&init_done, &(bool){ false }, true);
}
void
@@ -167,8 +166,7 @@ tls_shutdown(void) {
}
#endif
REQUIRE(atomic_compare_exchange_strong(&shut_done, &(bool){ false },
true));
atomic_compare_exchange_enforced(&shut_done, &(bool){ false }, true);
}
void