]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: thread: set DEBUG_THREAD to 1 by default
authorWilly Tarreau <w@1wt.eu>
Mon, 28 Apr 2025 13:57:26 +0000 (15:57 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 28 Apr 2025 14:50:34 +0000 (16:50 +0200)
Setting DEBUG_THREAD to 1 allows recording the lock history for each
thread. Tests have shown that (as predicted) the cost of updating a
single thread-local variable is not perceptible in the noise, especially
when compared to the cost of obtaining a lock. Since this can provide
useful value when debugging deadlocks, let's enable it by default when
threads are enabled.

include/haproxy/defaults.h

index 7b6b6ec0d1dd7d33e4a21d6c8d2c1e8df5f47790..1de038e3a961ce5bda0ca9ca7b078e1ddaa3d20c 100644 (file)
 # define DEBUG_STRICT 1
 #endif
 
-/* Let's make DEBUG_THREAD default to 0, and make sure it has a value */
+/* Let's make DEBUG_THREAD default to 1, and make sure it has a value */
 #ifndef DEBUG_THREAD
-# define DEBUG_THREAD 0
+# if defined(USE_THREAD)
+#  define DEBUG_THREAD 1
+# else
+#  define DEBUG_THREAD 0
+# endif
 #endif
 
 /* Let's make DEBUG_COUNTERS default to 1 to have glitches counters by default */