From: Willy Tarreau Date: Mon, 25 Apr 2022 17:23:17 +0000 (+0200) Subject: BUILD: thread: use initcall instead of a constructor X-Git-Tag: v2.6-dev8~79 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8ead1d084ad771da26135464bae70da34deb55fe;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/src/thread.c b/src/thread.c index a04e914d9e..9d601cc1d0 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