From 8ead1d084ad771da26135464bae70da34deb55fe Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Mon, 25 Apr 2022 19:23:17 +0200 Subject: [PATCH] BUILD: thread: use initcall instead of a constructor The constructor present there could be replaced with an initcall. This one is set at level STG_PREPARE because it also zeroes the lock_stats, and it's a bit odd that it could possibly have been scheduled to run after other constructors that might already preset some of these locks by accident. --- src/thread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/thread.c b/src/thread.c index a04e914d9..9d601cc1d 100644 --- a/src/thread.c +++ b/src/thread.c @@ -951,7 +951,6 @@ static inline void preload_libgcc_s(void) pthread_join(dummy_thread, NULL); } -__attribute__((constructor)) static void __thread_init(void) { char *ptr = NULL; @@ -975,6 +974,7 @@ static void __thread_init(void) memset(lock_stats, 0, sizeof(lock_stats)); #endif } +INITCALL0(STG_PREPARE, __thread_init); #else