about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <mwrap-perl@80x24.org>2022-12-19 11:19:18 +0000
committerEric Wong <mwrap-perl@80x24.org>2022-12-19 21:56:34 +0000
commit8c54822b289e02cf3d1d75cfaae9b931d65de798 (patch)
tree1f2df593931c80e56b043d7a951a6b336891cf3f
parent26a43bd9fc2510a29bc9b3178416ca4e2471865d (diff)
downloadmwrap-8c54822b289e02cf3d1d75cfaae9b931d65de798.tar.gz
It's no longer needed with our embedded malloc and our
non-glibc ensure_initialization() mutex avoidance hack.
-rw-r--r--mwrap_core.h15
1 files changed, 1 insertions, 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))