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.
This commit is contained in:
Willy Tarreau 2022-04-25 19:23:17 +02:00
parent 79367f9a8d
commit 8ead1d084a

View File

@ -951,7 +951,6 @@ static inline void preload_libgcc_s(void)
pthread_join(dummy_thread, NULL); pthread_join(dummy_thread, NULL);
} }
__attribute__((constructor))
static void __thread_init(void) static void __thread_init(void)
{ {
char *ptr = NULL; char *ptr = NULL;
@ -975,6 +974,7 @@ static void __thread_init(void)
memset(lock_stats, 0, sizeof(lock_stats)); memset(lock_stats, 0, sizeof(lock_stats));
#endif #endif
} }
INITCALL0(STG_PREPARE, __thread_init);
#else #else