MAJOR: threads: Offically enable the threads support in HAProxy
Now, USE_THREAD option is implicitly enabled when HAProxy is compiled, for
targets linux2628 and freebsd. To enable it for other targets, you can set
"USE_THREAD=1" explicitly on the command line. And to disable it explicitly, you
must set "USE_THREAD=" on the command line.
Now, to be clear. This does not means it is bug free, far from that. But it
seems stable enough to be tested. You can try to experiment it and to report
bugs of course by setting nbthread parameter. By leaving it to 1 (or not using
it at all), it should be as safe as an HAProxy compiled without threads.
Between the commit "MINOR: threads: Prepare makefile to link with pthread" and
this one, the feature was in development and really unstable. It could be hard
to track a bug using a bisect for all these commits.
diff --git a/Makefile b/Makefile
index c6f047d..49b68af 100644
--- a/Makefile
+++ b/Makefile
@@ -17,6 +17,7 @@
# USE_PCRE2_JIT : enable JIT for faster regex on libpcre2
# USE_POLL : enable poll(). Automatic.
# USE_PRIVATE_CACHE : disable shared memory cache of ssl sessions.
+# USE_THREAD : enable threads support.
# USE_PTHREAD_PSHARED : enable pthread process shared mutex on sslcache.
# USE_REGPARM : enable regparm optimization. Recommended on x86.
# USE_STATIC_PCRE : enable static libpcre. Recommended.
@@ -238,6 +239,9 @@
# passing USE_POLL="" on the make command line.
USE_POLL = default
+# Always enable threads support by default and let the Makefile detect if
+# HAProxy can be compiled with threads or not.
+
ifeq ($(TARGET),generic)
# generic system target has nothing specific
USE_POLL = implicit
@@ -298,6 +302,7 @@
USE_CPU_AFFINITY= implicit
ASSUME_SPLICE_WORKS= implicit
USE_DL = implicit
+ USE_THREAD = implicit
else
ifeq ($(TARGET),solaris)
# This is for Solaris 8
@@ -316,6 +321,7 @@
USE_KQUEUE = implicit
USE_TPROXY = implicit
USE_LIBCRYPT = implicit
+ USE_THREAD = implicit
else
ifeq ($(TARGET),osx)
# This is for Mac OS/X