]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: thread: use initcall instead of a constructor
authorWilly Tarreau <w@1wt.eu>
Mon, 25 Apr 2022 17:23:17 +0000 (19:23 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 25 Apr 2022 17:23:17 +0000 (19:23 +0200)
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

index a04e914d9e1958ecf446660f220e430635eccd9a..9d601cc1d024b339b63c4801c0c040671c66c66b 100644 (file)
@@ -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