MEDIUM: threads: Add hathreads header file
This file contains all functions and macros used to deal with concurrency in
HAProxy. It contains all high-level function to do atomic operation
(HA_ATOMIC_*). Note, for now, we rely on "__atomic" GCC builtins to do atomic
operation. So HAProxy can be compiled with the thread support iff these builtins
are available.
It also contains wrappers around plocks to use spin or read/write locks. These
wrappers are used to abstract the internal representation of the locking system
and to add information to help debugging, when compiled with suitable
options.
To add extra info on locks, you need to add DEBUG=-DDEBUG_THREAD or
DEBUG=-DDEBUG_FULL compilation option. In addition to timing info on locks, we
keep info on where a lock was acquired the last time (function name, file and
line). There are also the thread id and a flag to know if it is still locked or
not. This will be useful to debug deadlocks.
diff --git a/Makefile b/Makefile
index aa1a7fe..c6f047d 100644
--- a/Makefile
+++ b/Makefile
@@ -165,8 +165,8 @@
#### Debug settings
# You can enable debugging on specific code parts by setting DEBUG=-DDEBUG_xxx.
# Currently defined DEBUG macros include DEBUG_FULL, DEBUG_MEMORY, DEBUG_FSM,
-# DEBUG_HASH, DEBUG_AUTH and DEBUG_SPOE. Please check sources for exact meaning
-# or do not use at all.
+# DEBUG_HASH, DEBUG_AUTH, DEBUG_SPOE and DEBUG_THREAD. Please check sources for
+# exact meaning or do not use at all.
DEBUG =
#### Trace options
@@ -849,7 +849,8 @@
src/regex.o src/queue.o src/frontend.o src/arg.o src/proto_uxst.o \
src/raw_sock.o src/lb_chash.o src/lb_fwlc.o src/lb_fwrr.o \
src/lb_fas.o src/applet.o src/hdr_idx.o src/ev_select.o src/hash.o \
- src/lb_map.o src/base64.o src/sha1.o src/protocol.o src/h1.o src/action.o
+ src/lb_map.o src/base64.o src/sha1.o src/protocol.o src/h1.o \
+ src/action.o src/hathreads.o
EBTREE_OBJS = $(EBTREE_DIR)/ebtree.o \
$(EBTREE_DIR)/eb32tree.o $(EBTREE_DIR)/eb64tree.o \