mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-09 02:22:04 -04:00
Use ATOMIC_VAR_INIT to initialize tid_v_base to 0
This commit is contained in:
parent
4d021be52e
commit
c5b18d3dcb
1 changed files with 2 additions and 6 deletions
|
|
@ -47,6 +47,7 @@
|
|||
|
||||
#include <isc/atomic.h>
|
||||
#include <isc/hp.h>
|
||||
#include <isc/once.h>
|
||||
#include <isc/string.h>
|
||||
#include <isc/mem.h>
|
||||
#include <isc/util.h>
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue