BUG/MINOR: signals: ha_sigmask macro for multithreading
The behavior of sigprocmask in an multithreaded environment is
undefined.
The new macro ha_sigmask() calls either pthreads_sigmask() or
sigprocmask() if haproxy was built with thread support or not.
This should be backported to 1.8.
diff --git a/include/common/hathreads.h b/include/common/hathreads.h
index c25f691..5c4ceca 100644
--- a/include/common/hathreads.h
+++ b/include/common/hathreads.h
@@ -108,6 +108,9 @@
#define HA_RWLOCK_TRYRDLOCK(lbl, l) ({ 0; })
#define HA_RWLOCK_RDUNLOCK(lbl, l) do { /* do nothing */ } while(0)
+#define ha_sigmask(how, set, oldset) sigprocmask(how, set, oldset)
+
+
static inline void __ha_barrier_load(void)
{
}
@@ -259,6 +262,9 @@
extern unsigned long all_threads_mask;
+#define ha_sigmask(how, set, oldset) pthread_sigmask(how, set, oldset)
+
+
#if defined(DEBUG_THREAD) || defined(DEBUG_FULL)
/* WARNING!!! if you update this enum, please also keep lock_label() up to date below */