]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: threads: change lock_t to an unsigned int
authorWilly Tarreau <w@1wt.eu>
Sun, 18 Oct 2020 09:05:23 +0000 (11:05 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 19 Oct 2020 12:08:13 +0000 (14:08 +0200)
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

index e827361646e30d64a9cbe7aaeeaa4ba40ca9bdd0..bac83aedb00107c4d8a0e5ef0424a749409de547 100644 (file)
@@ -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