From 8f1f177ed0bbdb6c10e61e83994df113452d434f Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Sun, 18 Oct 2020 11:05:23 +0200 Subject: [PATCH] MINOR: threads: change lock_t to an unsigned int We don't need to waste the size of a long for the locks: with the plocks, even an unsigned short would offer enough room for up to 126 threads! Let's use an unsigned int which will be easier to place in certain structures and will more conveniently plug some holes, and Atomic ops are at least as fast on 32-bit as on 64-bit. This will not change anything for 32-bit platforms. --- include/haproxy/thread-t.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/haproxy/thread-t.h b/include/haproxy/thread-t.h index e827361..bac83ae 100644 --- a/include/haproxy/thread-t.h +++ b/include/haproxy/thread-t.h @@ -95,8 +95,8 @@ /*** Common parts below ***/ /* storage types used by spinlocks and RW locks */ -#define __HA_SPINLOCK_T unsigned long -#define __HA_RWLOCK_T unsigned long +#define __HA_SPINLOCK_T unsigned int +#define __HA_RWLOCK_T unsigned int /* When thread debugging is enabled, we remap HA_SPINLOCK_T and HA_RWLOCK_T to -- 1.7.10.4