mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 22:31:28 +02:00
MINOR: thread: provide a set of lock initialisers
This patch adds ha_spin_init() and ha_rwlock_init() which are used as a callback to initialise locks at boot time. They perform exactly the same as HA_SPIN_INIT() or HA_RWLOCK_INIT() but from within a real function.
This commit is contained in:
parent
0108d90c6c
commit
a8ae77da61
@ -948,6 +948,9 @@ static __inline int __ha_cas_dw(void *target, void *compare, void *set)
|
||||
#define __ha_barrier_full __sync_synchronize
|
||||
#endif
|
||||
|
||||
void ha_spin_init(HA_SPINLOCK_T *l);
|
||||
void ha_rwlock_init(HA_RWLOCK_T *l);
|
||||
|
||||
#endif /* USE_THREAD */
|
||||
|
||||
static inline void __ha_compiler_barrier(void)
|
||||
|
@ -92,6 +92,18 @@ void thread_release()
|
||||
thread_harmless_end();
|
||||
}
|
||||
|
||||
/* these calls are used as callbacks at init time */
|
||||
void ha_spin_init(HA_SPINLOCK_T *l)
|
||||
{
|
||||
HA_SPIN_INIT(l);
|
||||
}
|
||||
|
||||
/* these calls are used as callbacks at init time */
|
||||
void ha_rwlock_init(HA_RWLOCK_T *l)
|
||||
{
|
||||
HA_RWLOCK_INIT(l);
|
||||
}
|
||||
|
||||
__attribute__((constructor))
|
||||
static void __hathreads_init(void)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user