CLEANUP: threads: don't register an initcall when not debugging

It's a bit overkill to register an initcall to call a function to set
a lock to zero when not debugging, let's just declare the lock as
pre-initialized to zero.
This commit is contained in:
Willy Tarreau 2020-10-18 10:20:59 +02:00
parent fcb69d768b
commit 3d18498645
2 changed files with 23 additions and 3 deletions

View File

@ -45,9 +45,29 @@
#define __decl_rwlock(lock)
#define __decl_aligned_rwlock(lock)
#elif !defined(DEBUG_THREAD) && !defined(DEBUG_FULL)
/************** THREADS ENABLED WITHOUT DEBUGGING **************/
/* declare a self-initializing spinlock */
#define __decl_spinlock(lock) \
HA_SPINLOCK_T (lock) = 0;
/* declare a self-initializing spinlock, aligned on a cache line */
#define __decl_aligned_spinlock(lock) \
HA_SPINLOCK_T (lock) __attribute__((aligned(64))) = 0;
/* declare a self-initializing rwlock */
#define __decl_rwlock(lock) \
HA_RWLOCK_T (lock) = 0;
/* declare a self-initializing rwlock, aligned on a cache line */
#define __decl_aligned_rwlock(lock) \
HA_RWLOCK_T (lock) __attribute__((aligned(64))) = 0;
#else /* !USE_THREAD */
/********************** THREADS ENABLED ************************/
/**************** THREADS ENABLED WITH DEBUGGING ***************/
/* declare a self-initializing spinlock */
#define __decl_spinlock(lock) \

View File

@ -154,13 +154,13 @@ void ha_tkillall(int sig)
raise(sig);
}
/* these calls are used as callbacks at init time */
/* these calls are used as callbacks at init time when debugging is on */
void ha_spin_init(HA_SPINLOCK_T *l)
{
HA_SPIN_INIT(l);
}
/* these calls are used as callbacks at init time */
/* these calls are used as callbacks at init time when debugging is on */
void ha_rwlock_init(HA_RWLOCK_T *l)
{
HA_RWLOCK_INIT(l);