From 8c54822b289e02cf3d1d75cfaae9b931d65de798 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 19 Dec 2022 11:19:18 +0000 Subject: core: drop FreeBSD-specific mutex initialization It's no longer needed with our embedded malloc and our non-glibc ensure_initialization() mutex avoidance hack. --- mwrap_core.h | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/mwrap_core.h b/mwrap_core.h index 7f52f39..b382018 100644 --- a/mwrap_core.h +++ b/mwrap_core.h @@ -87,18 +87,11 @@ union padded_mutex { char pad[64]; /* cache alignment for common CPUs */ }; -/* a round-robin pool of mutexes */ +/* a pool of mutexes for all "struct src_loc" */ #define MUTEX_NR (1 << 6) #define MUTEX_MASK (MUTEX_NR - 1) -#ifdef __FreeBSD__ -# define STATIC_MTX_INIT_OK (0) -#else /* only tested on Linux + glibc */ -# define STATIC_MTX_INIT_OK (1) -#endif static union padded_mutex mutexes[MUTEX_NR] = { -#if STATIC_MTX_INIT_OK [0 ... (MUTEX_NR-1)].mtx = PTHREAD_MUTEX_INITIALIZER -#endif }; #ifdef static_assert @@ -1010,12 +1003,6 @@ __attribute__((constructor)) static void mwrap_ctor(void) ensure_initialization(); CHECK(int, 0, pthread_key_create(&tlskey, mstate_tsd_dtor)); - /* - * PTHREAD_MUTEX_INITIALIZER on FreeBSD means lazy initialization, - * which happens at pthread_mutex_lock, and that calls calloc - */ - if (!STATIC_MTX_INIT_OK) - reset_mutexes(); /* initialize mutexes used by urcu-bp */ CMM_STORE_SHARED(files, lfht_new(256)); if (!CMM_LOAD_SHARED(files)) -- cgit v1.2.3-24-ge0c7