From c5b18d3dcbe22c23fd98db9e485ab1634ee22618 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Thu, 28 Nov 2019 11:31:02 +0100 Subject: [PATCH] Use ATOMIC_VAR_INIT to initialize tid_v_base to 0 --- lib/isc/hp.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/isc/hp.c b/lib/isc/hp.c index 4d14a54c08..746d13fc0a 100644 --- a/lib/isc/hp.c +++ b/lib/isc/hp.c @@ -47,6 +47,7 @@ #include #include +#include #include #include #include @@ -61,8 +62,7 @@ #define TID_UNKNOWN -1 -static atomic_int_fast32_t tid_v_base; -static bool tid_v_initialized; +static atomic_int_fast32_t tid_v_base = ATOMIC_VAR_INIT(0); #if defined(HAVE_TLS) #if defined(HAVE_THREAD_LOCAL) @@ -94,10 +94,6 @@ struct isc_hp { static inline int tid() { - if (!tid_v_initialized) { - atomic_init(&tid_v_base, 0); - tid_v_initialized = true; - } if (tid_v == TID_UNKNOWN) { tid_v = atomic_fetch_add(&tid_v_base, 1); REQUIRE(tid_v < HP_MAX_THREADS);