]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
REORG: include: split hathreads into haproxy/thread.h and haproxy/thread-t.h
authorWilly Tarreau <w@1wt.eu>
Thu, 28 May 2020 13:29:19 +0000 (15:29 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 11 Jun 2020 08:18:56 +0000 (10:18 +0200)
This splits the hathreads.h file into types+macros and functions. Given
that most users of this file used to include it only to get the definition
of THREAD_LOCAL and MAXTHREADS, the bare minimum was placed into thread-t.h
(i.e. types and macros).

All the thread management was left to haproxy/thread.h. It's worth noting
the drop of the trailing "s" in the name, to remove the permanent confusion
that arises between this one and the system implementation (no "s") and the
makefile's option (no "s").

For consistency, src/hathreads.c was also renamed thread.c.

A number of files were updated to only include thread-t which is the one
they really needed.

Some future improvements are possible like replacing empty inlined
functions with macros for the thread-less case, as building at -O0 disables
inlining and causes these ones to be emitted. But this really is cosmetic.

47 files changed:
MAINTAINERS
Makefile
include/common/memory.h
include/common/regex.h
include/common/time.h
include/haproxy/list.h
include/haproxy/thread-t.h [new file with mode: 0644]
include/haproxy/thread.h [moved from include/common/hathreads.h with 73% similarity]
include/proto/log.h
include/proto/protocol.h
include/proto/signal.h
include/proto/task.h
include/types/backend.h
include/types/dict.h
include/types/dns.h
include/types/global.h
include/types/listener.h
include/types/log.h
include/types/proxy.h
include/types/server.h
include/types/spoe.h
include/types/ssl_sock.h
include/types/vars.h
src/51d.c
src/activity.c
src/auth.c
src/cfgparse.c
src/checks.c
src/compression.c
src/debug.c
src/ev_epoll.c
src/ev_evports.c
src/ev_kqueue.c
src/ev_poll.c
src/ev_select.c
src/flt_spoe.c
src/haproxy.c
src/hlua.c
src/memory.c
src/peers.c
src/pipe.c
src/queue.c
src/ring.c
src/stream.c
src/thread.c [moved from src/hathreads.c with 99% similarity]
src/time.c
src/wdt.c

index 95b0175216717aa4e5adf4caa82ceed159b81f5c..f17c6480a02b4873c8ca77552814e0899b926012 100644 (file)
@@ -77,7 +77,7 @@ Files: src/flt_spoe.c, include/*/spoe.h, contrib/spoa_example, doc/SPOE.txt
 Multi-threading
 Maintainer: Christopher Faulet <cfaulet@haproxy.com>
 Maintainer: Emeric Brun <ebrun@haproxy.com>
-Files: src/hathreads.c, include/*/hathreads.h
+Files: src/thread.c, include/*/thread.h
 Note: every change around the locking or synchronization point will require
       approval from one of these maintainers. Problems which only appear when
       nbthread is greater than 1 and which disappear otherwise are also
index ed736119b742f69ab3ffacc6e39d56a822dc3494..f7155d02abab842bc4cff0ae599d0f1f0f636131 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -805,7 +805,7 @@ OBJS = src/mux_h2.o src/stream.o src/mux_fcgi.o src/cfgparse-listen.o         \
        src/htx.o src/memory.o src/applet.o src/channel.o src/signal.o         \
        src/lb_fwrr.o src/ev_select.o src/sink.o src/http_conv.o               \
        src/proto_sockpair.o src/mworker-prog.o src/activity.o src/lb_fwlc.o   \
-       src/http.o src/lb_fas.o src/uri_auth.o src/hathreads.o src/regex.o     \
+       src/http.o src/lb_fas.o src/uri_auth.o src/thread.o src/regex.o        \
        src/auth.o src/buffer.o src/compression.o src/proto_udp.o src/lb_map.o \
        src/chunk.o src/wdt.o src/hpack-dec.o src/action.o src/xxhash.o        \
        src/pipe.o src/shctx.o src/hpack-tbl.o src/http_acl.o src/sha1.o       \
index d80b4868cb79421f5eedee93d1e52317d92546f3..3858ae4eb37afaed0a96185019ff88316209cc1f 100644 (file)
@@ -30,7 +30,7 @@
 
 #include <haproxy/api.h>
 #include <haproxy/list.h>
-#include <common/hathreads.h>
+#include <haproxy/thread.h>
 
 /* On architectures supporting threads and double-word CAS, we can implement
  * lock-less memory pools. This isn't supported for debugging modes however.
index d106b8690fc96dd062f42782608936f4ec5e5e4d..79e54ff12d4a3f22ad3c59875246fb10b06b3e57 100644 (file)
@@ -26,7 +26,7 @@
 #include <string.h>
 
 #include <haproxy/api.h>
-#include <common/hathreads.h>
+#include <haproxy/thread-t.h>
 
 #ifdef USE_PCRE
 #include <pcre.h>
index 2a4ec0afc6357359039a9b72d64646cf472aeda0..d6863d42c89d44a0cbb39e50b223d3dc5131d1f5 100644 (file)
@@ -26,7 +26,7 @@
 #include <unistd.h>
 #include <sys/time.h>
 #include <haproxy/api.h>
-#include <common/hathreads.h>
+#include <haproxy/thread.h>
 #include <common/standard.h>
 
 /* eternity when exprimed in timeval */
index 0281aa1a4f2b1223fcfcef701e8aab4575c62930..a35502c67a166f5573c1251d65b0b2a1928720fc 100644 (file)
@@ -24,7 +24,7 @@
 
 #include <haproxy/api.h>
 #include <haproxy/list-t.h>
-#include <common/hathreads.h>
+#include <haproxy/thread.h>
 
 /* First undefine some macros which happen to also be defined on OpenBSD,
  * in sys/queue.h, used by sys/event.h
diff --git a/include/haproxy/thread-t.h b/include/haproxy/thread-t.h
new file mode 100644 (file)
index 0000000..d933244
--- /dev/null
@@ -0,0 +1,171 @@
+/*
+ * include/haproxy/thread-t.h
+ * Definitions and types for thread support.
+ *
+ * Copyright (C) 2017 Christopher Faulet - cfaulet@haproxy.com
+ * Copyright (C) 2020 Willy Tarreau - w@1wt.eu
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, version 2.1
+ * exclusively.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef _HAPROXY_THREAD_T_H
+#define _HAPROXY_THREAD_T_H
+
+#ifdef USE_THREAD
+#include <pthread.h>
+#endif
+#include <time.h>
+
+
+/* Note: this file mainly contains 3 sections:
+ *   - one used solely when USE_THREAD is *not* set
+ *   - one used solely when USE_THREAD is set
+ *   - a common one.
+ */
+
+#ifndef USE_THREAD
+
+/********************** THREADS DISABLED ************************/
+
+#define THREAD_LOCAL  /* empty */
+#define MAX_THREADS 1
+#define MAX_THREADS_MASK 1
+
+/* These macros allow to make some struct fields or local variables optional */
+#define __decl_hathreads(decl)
+#define __decl_spinlock(lock)
+#define __decl_aligned_spinlock(lock)
+#define __decl_rwlock(lock)
+#define __decl_aligned_rwlock(lock)
+
+#else /* !USE_THREAD */
+
+/********************** THREADS ENABLED ************************/
+
+#define THREAD_LOCAL __thread
+
+#ifndef MAX_THREADS
+#define MAX_THREADS LONGBITS
+#endif
+
+#define MAX_THREADS_MASK (~0UL >> (LONGBITS - MAX_THREADS))
+
+#define __decl_hathreads(decl) decl
+
+/* declare a self-initializing spinlock */
+#define __decl_spinlock(lock)                               \
+       HA_SPINLOCK_T (lock);                               \
+       INITCALL1(STG_LOCK, ha_spin_init, &(lock))
+
+/* declare a self-initializing spinlock, aligned on a cache line */
+#define __decl_aligned_spinlock(lock)                       \
+       HA_SPINLOCK_T (lock) __attribute__((aligned(64)));  \
+       INITCALL1(STG_LOCK, ha_spin_init, &(lock))
+
+/* declare a self-initializing rwlock */
+#define __decl_rwlock(lock)                                 \
+       HA_RWLOCK_T   (lock);                               \
+       INITCALL1(STG_LOCK, ha_rwlock_init, &(lock))
+
+/* declare a self-initializing rwlock, aligned on a cache line */
+#define __decl_aligned_rwlock(lock)                         \
+       HA_RWLOCK_T   (lock) __attribute__((aligned(64)));  \
+       INITCALL1(STG_LOCK, ha_rwlock_init, &(lock))
+
+#endif /* USE_THREAD */
+
+
+/*** Common parts below ***/
+
+/* thread info flags, for ha_thread_info[].flags */
+#define TI_FL_STUCK             0x00000001
+
+/* This structure describes all the per-thread info we need. When threads are
+ * disabled, it contains the same info for the single running thread (except
+ * the pthread identifier which does not exist).
+ */
+struct thread_info {
+       __decl_hathreads(pthread_t pthread);
+       clockid_t clock_id;
+       timer_t wd_timer;          /* valid timer or TIMER_INVALID if not set */
+       uint64_t prev_cpu_time;    /* previous per thread CPU time */
+       uint64_t prev_mono_time;   /* previous system wide monotonic time  */
+       unsigned int idle_pct;     /* idle to total ratio over last sample (percent) */
+       unsigned int flags;        /* thread info flags, TI_FL_* */
+       /* pad to cache line (64B) */
+       char __pad[0];            /* unused except to check remaining room */
+       char __end[0] __attribute__((aligned(64)));
+};
+
+/* storage types used by spinlocks and RW locks */
+#define __HA_SPINLOCK_T     unsigned long
+#define __HA_RWLOCK_T       unsigned long
+
+
+/* When thread debugging is enabled, we remap HA_SPINLOCK_T and HA_RWLOCK_T to
+ * complex structures which embed debugging info.
+ */
+#if !defined(DEBUG_THREAD) && !defined(DEBUG_FULL)
+
+#define HA_SPINLOCK_T        __HA_SPINLOCK_T
+#define HA_RWLOCK_T          __HA_RWLOCK_T
+
+#else /* !DEBUG_THREAD */
+
+#define HA_SPINLOCK_T       struct ha_spinlock
+#define HA_RWLOCK_T         struct ha_rwlock
+
+/* Debugging information that is only used when thread debugging is enabled */
+
+struct lock_stat {
+       uint64_t nsec_wait_for_write;
+       uint64_t nsec_wait_for_read;
+       uint64_t num_write_locked;
+       uint64_t num_write_unlocked;
+       uint64_t num_read_locked;
+       uint64_t num_read_unlocked;
+};
+
+struct ha_spinlock {
+       __HA_SPINLOCK_T lock;
+       struct {
+               unsigned long owner; /* a bit is set to 1 << tid for the lock owner */
+               unsigned long waiters; /* a bit is set to 1 << tid for waiting threads  */
+               struct {
+                       const char *function;
+                       const char *file;
+                       int line;
+               } last_location; /* location of the last owner */
+       } info;
+};
+
+struct ha_rwlock {
+       __HA_RWLOCK_T lock;
+       struct {
+               unsigned long cur_writer; /* a bit is set to 1 << tid for the lock owner */
+               unsigned long wait_writers; /* a bit is set to 1 << tid for waiting writers */
+               unsigned long cur_readers; /* a bit is set to 1 << tid for current readers */
+               unsigned long wait_readers; /* a bit is set to 1 << tid for waiting waiters */
+               struct {
+                       const char *function;
+                       const char *file;
+                       int line;
+               } last_location; /* location of the last write owner */
+       } info;
+};
+
+#endif  /* DEBUG_THREAD */
+
+#endif /* _HAPROXY_THREAD_T_H */
similarity index 73%
rename from include/common/hathreads.h
rename to include/haproxy/thread.h
index 6146998f0134574b4d76392acaee3ccfd06304a6..1afd95848f446bd03c542f04ce66c5d23c9aa152 100644 (file)
@@ -1,8 +1,9 @@
 /*
- * include/common/hathreads.h
- * definitions, macros and inline functions about threads.
+ * include/haproxy/thread.h
+ * definitions, macros and inline functions used by threads.
  *
- * Copyright (C) 2017 Christopher Fauet - cfaulet@haproxy.com
+ * Copyright (C) 2017 Christopher Faulet - cfaulet@haproxy.com
+ * Copyright (C) 2020 Willy Tarreau - w@1wt.eu
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef _COMMON_HATHREADS_H
-#define _COMMON_HATHREADS_H
+#ifndef _HAPROXY_THREAD_H
+#define _HAPROXY_THREAD_H
 
 #include <signal.h>
 #include <unistd.h>
 #ifdef _POSIX_PRIORITY_SCHEDULING
 #include <sched.h>
 #endif
+
 #include <haproxy/atomic.h>
 #include <haproxy/api.h>
+#include <haproxy/thread-t.h>
 
 
-/* Note about all_threads_mask :
- *    - this variable is comprised between 1 and LONGBITS.
- *    - with threads support disabled, this symbol is defined as constant 1UL.
- *    - with threads enabled, it contains the mask of enabled threads. Thus if
- *      only one thread is enabled, it equals 1.
+/* Note: this file mainly contains 5 sections:
+ *   - a small common part, which also corresponds to the common API
+ *   - one used solely when USE_THREAD is *not* set
+ *   - one used solely when USE_THREAD is set
+ *   - one used solely when USE_THREAD is set WITHOUT debugging
+ *   - one used solely when USE_THREAD is set WITH debugging
+ *
  */
 
-/* thread info flags, for ha_thread_info[].flags */
-#define TI_FL_STUCK             0x00000001
+
+/* Generic exports */
+int parse_nbthread(const char *arg, char **err);
+int thread_get_default_count();
+extern int thread_cpus_enabled_at_boot;
+extern struct thread_info ha_thread_info[MAX_THREADS];
+extern THREAD_LOCAL struct thread_info *ti; /* thread_info for the current thread */
 
 
 #ifndef USE_THREAD
 
-#define THREAD_LOCAL  /* empty */
-#define MAX_THREADS 1
-#define MAX_THREADS_MASK 1
+/********************** THREADS DISABLED ************************/
 
 /* Only way found to replace variables with constants that are optimized away
  * at build time.
  */
 enum { all_threads_mask = 1UL };
 enum { threads_harmless_mask = 0 };
-enum { threads_want_rdv_mask = 0 };
 enum { threads_sync_mask = 0 };
+enum { threads_want_rdv_mask = 0 };
 enum { tid_bit = 1UL };
 enum { tid = 0 };
 
-extern struct thread_info {
-       clockid_t clock_id;
-       timer_t wd_timer;          /* valid timer or TIMER_INVALID if not set */
-       uint64_t prev_cpu_time;    /* previous per thread CPU time */
-       uint64_t prev_mono_time;   /* previous system wide monotonic time  */
-       unsigned int idle_pct;     /* idle to total ratio over last sample (percent) */
-       unsigned int flags;        /* thread info flags, TI_FL_* */
-       /* pad to cache line (64B) */
-       char __pad[0];            /* unused except to check remaining room */
-       char __end[0] __attribute__((aligned(64)));
-} ha_thread_info[MAX_THREADS];
-
-extern THREAD_LOCAL struct thread_info *ti; /* thread_info for the current thread */
+#define HA_SPIN_INIT(l)               do { /* do nothing */ } while(0)
+#define HA_SPIN_DESTROY(l)            do { /* do nothing */ } while(0)
+#define HA_SPIN_LOCK(lbl, l)          do { /* do nothing */ } while(0)
+#define HA_SPIN_TRYLOCK(lbl, l)       ({ 0; })
+#define HA_SPIN_UNLOCK(lbl, l)        do { /* do nothing */ } while(0)
 
-#define __decl_hathreads(decl)
-#define __decl_spinlock(lock)
-#define __decl_aligned_spinlock(lock)
-#define __decl_rwlock(lock)
-#define __decl_aligned_rwlock(lock)
-
-#define HA_SPIN_INIT(l)         do { /* do nothing */ } while(0)
-#define HA_SPIN_DESTROY(l)      do { /* do nothing */ } while(0)
-#define HA_SPIN_LOCK(lbl, l)    do { /* do nothing */ } while(0)
-#define HA_SPIN_TRYLOCK(lbl, l) ({ 0; })
-#define HA_SPIN_UNLOCK(lbl, l)  do { /* do nothing */ } while(0)
-
-#define HA_RWLOCK_INIT(l)          do { /* do nothing */ } while(0)
-#define HA_RWLOCK_DESTROY(l)       do { /* do nothing */ } while(0)
-#define HA_RWLOCK_WRLOCK(lbl, l)   do { /* do nothing */ } while(0)
+#define HA_RWLOCK_INIT(l)             do { /* do nothing */ } while(0)
+#define HA_RWLOCK_DESTROY(l)          do { /* do nothing */ } while(0)
+#define HA_RWLOCK_WRLOCK(lbl, l)      do { /* do nothing */ } while(0)
 #define HA_RWLOCK_TRYWRLOCK(lbl, l)   ({ 0; })
-#define HA_RWLOCK_WRUNLOCK(lbl, l) do { /* do nothing */ } while(0)
-#define HA_RWLOCK_RDLOCK(lbl, l)   do { /* do nothing */ } while(0)
+#define HA_RWLOCK_WRUNLOCK(lbl, l)    do { /* do nothing */ } while(0)
+#define HA_RWLOCK_RDLOCK(lbl, l)      do { /* do nothing */ } while(0)
 #define HA_RWLOCK_TRYRDLOCK(lbl, l)   ({ 0; })
-#define HA_RWLOCK_RDUNLOCK(lbl, l) do { /* do nothing */ } while(0)
+#define HA_RWLOCK_RDUNLOCK(lbl, l)    do { /* do nothing */ } while(0)
 
 #define ha_sigmask(how, set, oldset)  sigprocmask(how, set, oldset)
 
@@ -149,71 +137,30 @@ static inline unsigned long thread_isolated()
        return 1;
 }
 
-#else /* USE_THREAD */
+#else /* !USE_THREAD */
+
+/********************** THREADS ENABLED ************************/
 
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <pthread.h>
 #include <import/plock.h>
 
-#define THREAD_LOCAL __thread
-
-#ifndef MAX_THREADS
-#define MAX_THREADS LONGBITS
-#endif
-
-#define MAX_THREADS_MASK (~0UL >> (LONGBITS - MAX_THREADS))
-
-#define __decl_hathreads(decl) decl
-
-/* declare a self-initializing spinlock */
-#define __decl_spinlock(lock)                               \
-       HA_SPINLOCK_T (lock);                               \
-       INITCALL1(STG_LOCK, ha_spin_init, &(lock))
-
-/* declare a self-initializing spinlock, aligned on a cache line */
-#define __decl_aligned_spinlock(lock)                       \
-       HA_SPINLOCK_T (lock) __attribute__((aligned(64)));  \
-       INITCALL1(STG_LOCK, ha_spin_init, &(lock))
-
-/* declare a self-initializing rwlock */
-#define __decl_rwlock(lock)                                 \
-       HA_RWLOCK_T   (lock);                               \
-       INITCALL1(STG_LOCK, ha_rwlock_init, &(lock))
-
-/* declare a self-initializing rwlock, aligned on a cache line */
-#define __decl_aligned_rwlock(lock)                         \
-       HA_RWLOCK_T   (lock) __attribute__((aligned(64)));  \
-       INITCALL1(STG_LOCK, ha_rwlock_init, &(lock))
-
 void thread_harmless_till_end();
 void thread_isolate();
 void thread_release();
 void thread_sync_release();
 void ha_tkill(unsigned int thr, int sig);
 void ha_tkillall(int sig);
+void ha_spin_init(HA_SPINLOCK_T *l);
+void ha_rwlock_init(HA_RWLOCK_T *l);
 
-extern struct thread_info {
-       pthread_t pthread;
-       clockid_t clock_id;
-       timer_t wd_timer;          /* valid timer or TIMER_INVALID if not set */
-       uint64_t prev_cpu_time;    /* previous per thread CPU time */
-       uint64_t prev_mono_time;   /* previous system wide monotonic time  */
-       unsigned int idle_pct;     /* idle to total ratio over last sample (percent) */
-       unsigned int flags;        /* thread info flags, TI_FL_* */
-       /* pad to cache line (64B) */
-       char __pad[0];            /* unused except to check remaining room */
-       char __end[0] __attribute__((aligned(64)));
-} ha_thread_info[MAX_THREADS];
-
-extern THREAD_LOCAL unsigned int tid;     /* The thread id */
-extern THREAD_LOCAL unsigned long tid_bit; /* The bit corresponding to the thread id */
-extern THREAD_LOCAL struct thread_info *ti; /* thread_info for the current thread */
 extern volatile unsigned long all_threads_mask;
-extern volatile unsigned long threads_want_rdv_mask;
 extern volatile unsigned long threads_harmless_mask;
 extern volatile unsigned long threads_sync_mask;
+extern volatile unsigned long threads_want_rdv_mask;
+extern THREAD_LOCAL unsigned long tid_bit; /* The bit corresponding to the thread id */
+extern THREAD_LOCAL unsigned int tid;      /* The thread id */
 
 /* explanation for threads_want_rdv_mask, threads_harmless_mask, and
  * threads_sync_mask :
@@ -324,9 +271,63 @@ static inline unsigned long thread_isolated()
 }
 
 
-#if defined(DEBUG_THREAD) || defined(DEBUG_FULL)
+#if !defined(DEBUG_THREAD) && !defined(DEBUG_FULL)
+
+/* Thread debugging is DISABLED, these are the regular locking functions */
+
+#define HA_SPIN_INIT(l)            ({ (*l) = 0; })
+#define HA_SPIN_DESTROY(l)         ({ (*l) = 0; })
+#define HA_SPIN_LOCK(lbl, l)       pl_take_s(l)
+#define HA_SPIN_TRYLOCK(lbl, l)    !pl_try_s(l)
+#define HA_SPIN_UNLOCK(lbl, l)     pl_drop_s(l)
+
+#define HA_RWLOCK_INIT(l)          ({ (*l) = 0; })
+#define HA_RWLOCK_DESTROY(l)       ({ (*l) = 0; })
+#define HA_RWLOCK_WRLOCK(lbl,l)    pl_take_w(l)
+#define HA_RWLOCK_TRYWRLOCK(lbl,l) !pl_try_w(l)
+#define HA_RWLOCK_WRUNLOCK(lbl,l)  pl_drop_w(l)
+#define HA_RWLOCK_RDLOCK(lbl,l)    pl_take_r(l)
+#define HA_RWLOCK_TRYRDLOCK(lbl,l) !pl_try_r(l)
+#define HA_RWLOCK_RDUNLOCK(lbl,l)  pl_drop_r(l)
+
+#else /* !defined(DEBUG_THREAD) && !defined(DEBUG_FULL) */
+
+/* Thread debugging is ENABLED, these are the instrumented functions */
+
+#define __SPIN_INIT(l)             ({ (*l) = 0; })
+#define __SPIN_DESTROY(l)          ({ (*l) = 0; })
+#define __SPIN_LOCK(l)             pl_take_s(l)
+#define __SPIN_TRYLOCK(l)          !pl_try_s(l)
+#define __SPIN_UNLOCK(l)           pl_drop_s(l)
+
+#define __RWLOCK_INIT(l)           ({ (*l) = 0; })
+#define __RWLOCK_DESTROY(l)        ({ (*l) = 0; })
+#define __RWLOCK_WRLOCK(l)         pl_take_w(l)
+#define __RWLOCK_TRYWRLOCK(l)      !pl_try_w(l)
+#define __RWLOCK_WRUNLOCK(l)       pl_drop_w(l)
+#define __RWLOCK_RDLOCK(l)         pl_take_r(l)
+#define __RWLOCK_TRYRDLOCK(l)      !pl_try_r(l)
+#define __RWLOCK_RDUNLOCK(l)       pl_drop_r(l)
+
+#define HA_SPIN_INIT(l)            __spin_init(l)
+#define HA_SPIN_DESTROY(l)         __spin_destroy(l)
+
+#define HA_SPIN_LOCK(lbl, l)       __spin_lock(lbl, l, __func__, __FILE__, __LINE__)
+#define HA_SPIN_TRYLOCK(lbl, l)    __spin_trylock(lbl, l, __func__, __FILE__, __LINE__)
+#define HA_SPIN_UNLOCK(lbl, l)     __spin_unlock(lbl, l, __func__, __FILE__, __LINE__)
+
+#define HA_RWLOCK_INIT(l)          __ha_rwlock_init((l))
+#define HA_RWLOCK_DESTROY(l)       __ha_rwlock_destroy((l))
+#define HA_RWLOCK_WRLOCK(lbl,l)    __ha_rwlock_wrlock(lbl, l, __func__, __FILE__, __LINE__)
+#define HA_RWLOCK_TRYWRLOCK(lbl,l) __ha_rwlock_trywrlock(lbl, l, __func__, __FILE__, __LINE__)
+#define HA_RWLOCK_WRUNLOCK(lbl,l)  __ha_rwlock_wrunlock(lbl, l, __func__, __FILE__, __LINE__)
+#define HA_RWLOCK_RDLOCK(lbl,l)    __ha_rwlock_rdlock(lbl, l)
+#define HA_RWLOCK_TRYRDLOCK(lbl,l) __ha_rwlock_tryrdlock(lbl, l)
+#define HA_RWLOCK_RDUNLOCK(lbl,l)  __ha_rwlock_rdunlock(lbl, l)
 
-/* WARNING!!! if you update this enum, please also keep lock_label() up to date below */
+/* WARNING!!! if you update this enum, please also keep lock_label() up to date
+ * below.
+ */
 enum lock_label {
        TASK_RQ_LOCK,
        TASK_WQ_LOCK,
@@ -365,84 +366,9 @@ enum lock_label {
        OTHER_LOCK,
        LOCK_LABELS
 };
-struct lock_stat {
-       uint64_t nsec_wait_for_write;
-       uint64_t nsec_wait_for_read;
-       uint64_t num_write_locked;
-       uint64_t num_write_unlocked;
-       uint64_t num_read_locked;
-       uint64_t num_read_unlocked;
-};
 
 extern struct lock_stat lock_stats[LOCK_LABELS];
 
-#define __HA_SPINLOCK_T      unsigned long
-
-#define __SPIN_INIT(l)         ({ (*l) = 0; })
-#define __SPIN_DESTROY(l)      ({ (*l) = 0; })
-#define __SPIN_LOCK(l)         pl_take_s(l)
-#define __SPIN_TRYLOCK(l)      !pl_try_s(l)
-#define __SPIN_UNLOCK(l)       pl_drop_s(l)
-
-#define __HA_RWLOCK_T          unsigned long
-
-#define __RWLOCK_INIT(l)          ({ (*l) = 0; })
-#define __RWLOCK_DESTROY(l)       ({ (*l) = 0; })
-#define __RWLOCK_WRLOCK(l)        pl_take_w(l)
-#define __RWLOCK_TRYWRLOCK(l)     !pl_try_w(l)
-#define __RWLOCK_WRUNLOCK(l)      pl_drop_w(l)
-#define __RWLOCK_RDLOCK(l)        pl_take_r(l)
-#define __RWLOCK_TRYRDLOCK(l)     !pl_try_r(l)
-#define __RWLOCK_RDUNLOCK(l)      pl_drop_r(l)
-
-#define HA_SPINLOCK_T       struct ha_spinlock
-
-#define HA_SPIN_INIT(l)        __spin_init(l)
-#define HA_SPIN_DESTROY(l)      __spin_destroy(l)
-
-#define HA_SPIN_LOCK(lbl, l)    __spin_lock(lbl, l, __func__, __FILE__, __LINE__)
-#define HA_SPIN_TRYLOCK(lbl, l) __spin_trylock(lbl, l, __func__, __FILE__, __LINE__)
-#define HA_SPIN_UNLOCK(lbl, l)  __spin_unlock(lbl, l, __func__, __FILE__, __LINE__)
-
-#define HA_RWLOCK_T         struct ha_rwlock
-
-#define HA_RWLOCK_INIT(l)          __ha_rwlock_init((l))
-#define HA_RWLOCK_DESTROY(l)       __ha_rwlock_destroy((l))
-#define HA_RWLOCK_WRLOCK(lbl,l)    __ha_rwlock_wrlock(lbl, l, __func__, __FILE__, __LINE__)
-#define HA_RWLOCK_TRYWRLOCK(lbl,l) __ha_rwlock_trywrlock(lbl, l, __func__, __FILE__, __LINE__)
-#define HA_RWLOCK_WRUNLOCK(lbl,l)  __ha_rwlock_wrunlock(lbl, l, __func__, __FILE__, __LINE__)
-#define HA_RWLOCK_RDLOCK(lbl,l)    __ha_rwlock_rdlock(lbl, l)
-#define HA_RWLOCK_TRYRDLOCK(lbl,l) __ha_rwlock_tryrdlock(lbl, l)
-#define HA_RWLOCK_RDUNLOCK(lbl,l)  __ha_rwlock_rdunlock(lbl, l)
-
-struct ha_spinlock {
-       __HA_SPINLOCK_T lock;
-       struct {
-               unsigned long owner; /* a bit is set to 1 << tid for the lock owner */
-               unsigned long waiters; /* a bit is set to 1 << tid for waiting threads  */
-               struct {
-                       const char *function;
-                       const char *file;
-                       int line;
-               } last_location; /* location of the last owner */
-       } info;
-};
-
-struct ha_rwlock {
-       __HA_RWLOCK_T lock;
-       struct {
-               unsigned long cur_writer; /* a bit is set to 1 << tid for the lock owner */
-               unsigned long wait_writers; /* a bit is set to 1 << tid for waiting writers */
-               unsigned long cur_readers; /* a bit is set to 1 << tid for current readers */
-               unsigned long wait_readers; /* a bit is set to 1 << tid for waiting waiters */
-               struct {
-                       const char *function;
-                       const char *file;
-                       int line;
-               } last_location; /* location of the last write owner */
-       } info;
-};
-
 static inline const char *lock_label(enum lock_label label)
 {
        switch (label) {
@@ -519,7 +445,8 @@ static inline void show_lock_stats()
 /* Following functions are used to collect some stats about locks. We wrap
  * pthread functions to known how much time we wait in a lock. */
 
-static uint64_t nsec_now(void) {
+static uint64_t nsec_now(void)
+{
         struct timespec ts;
 
         clock_gettime(CLOCK_MONOTONIC, &ts);
@@ -772,38 +699,8 @@ static inline void __spin_unlock(enum lock_label lbl, struct ha_spinlock *l,
        HA_ATOMIC_ADD(&lock_stats[lbl].num_write_unlocked, 1);
 }
 
-#else /* DEBUG_THREAD */
-
-#define HA_SPINLOCK_T        unsigned long
-
-#define HA_SPIN_INIT(l)         ({ (*l) = 0; })
-#define HA_SPIN_DESTROY(l)      ({ (*l) = 0; })
-#define HA_SPIN_LOCK(lbl, l)    pl_take_s(l)
-#define HA_SPIN_TRYLOCK(lbl, l) !pl_try_s(l)
-#define HA_SPIN_UNLOCK(lbl, l)  pl_drop_s(l)
-
-#define HA_RWLOCK_T            unsigned long
-
-#define HA_RWLOCK_INIT(l)          ({ (*l) = 0; })
-#define HA_RWLOCK_DESTROY(l)       ({ (*l) = 0; })
-#define HA_RWLOCK_WRLOCK(lbl,l)    pl_take_w(l)
-#define HA_RWLOCK_TRYWRLOCK(lbl,l) !pl_try_w(l)
-#define HA_RWLOCK_WRUNLOCK(lbl,l)  pl_drop_w(l)
-#define HA_RWLOCK_RDLOCK(lbl,l)    pl_take_r(l)
-#define HA_RWLOCK_TRYRDLOCK(lbl,l) !pl_try_r(l)
-#define HA_RWLOCK_RDUNLOCK(lbl,l)  pl_drop_r(l)
-
 #endif  /* DEBUG_THREAD */
 
-
-void ha_spin_init(HA_SPINLOCK_T *l);
-void ha_rwlock_init(HA_RWLOCK_T *l);
-
 #endif /* USE_THREAD */
 
-extern int thread_cpus_enabled_at_boot;
-
-int parse_nbthread(const char *arg, char **err);
-int thread_get_default_count();
-
-#endif /* _COMMON_HATHREADS_H */
+#endif /* _HAPROXY_THREAD_H */
index a84d61263f9b7b95425d0fe925407aac2ddc8c6f..ef792c81a59be095551bce4501c3a20d789a42fa 100644 (file)
@@ -28,7 +28,7 @@
 
 #include <haproxy/api.h>
 #include <common/memory.h>
-#include <common/hathreads.h>
+#include <haproxy/thread-t.h>
 
 #include <types/log.h>
 #include <types/proxy.h>
index f25f77f0a06455c8582aa3f6a50eb1c1643cd8fd..ee9e7e0c446b106844b07b2254b61c8de7e4ba28 100644 (file)
@@ -23,7 +23,7 @@
 #define _PROTO_PROTOCOL_H
 
 #include <sys/socket.h>
-#include <common/hathreads.h>
+#include <haproxy/thread.h>
 #include <types/protocol.h>
 
 extern struct protocol *__protocol_by_family[AF_CUST_MAX];
index ef2892a1c41faf61735cad01156d84f0bdf74041..558fbc20aba1ff414ec337eb5c5d41ee0e58ff8e 100644 (file)
@@ -13,7 +13,7 @@
 
 #include <signal.h>
 #include <common/standard.h>
-#include <common/hathreads.h>
+#include <haproxy/thread.h>
 
 #include <types/signal.h>
 #include <types/task.h>
index 944ada50a4808342aa878153b7d0a3c71180053a..668cee3f4cd350450d4ea67713145a70e29bf952 100644 (file)
@@ -30,7 +30,7 @@
 #include <haproxy/list.h>
 #include <common/standard.h>
 #include <common/ticks.h>
-#include <common/hathreads.h>
+#include <haproxy/thread.h>
 
 #include <import/eb32sctree.h>
 #include <import/eb32tree.h>
index 3150ecf1b639ba8b7cd0b8ed6777dc10d411a367..679805879e2f533c658c03034b89fa13862df85e 100644 (file)
@@ -23,7 +23,7 @@
 #define _TYPES_BACKEND_H
 
 #include <haproxy/api-t.h>
-#include <common/hathreads.h>
+#include <haproxy/thread.h>
 
 #include <types/lb_chash.h>
 #include <types/lb_fas.h>
index 30953f6cee9d4a4ebd67e3dea70e46cc90df0a46..980781692c0e9d279a85597448e7a001c39d040a 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef _TYPES_DICT_H
 #define _TYPES_DICT_H
 
-#include <common/hathreads.h>
+#include <haproxy/thread.h>
 #include <import/ebpttree.h>
 
 struct dict_entry {
index 84a82190a6889a59e529578d4adb37215f692ce8..0a8bf72dbac0d03efc2c166ac14c5bbd8e5c909b 100644 (file)
@@ -25,7 +25,7 @@
 #include <import/eb32tree.h>
 
 #include <haproxy/list-t.h>
-#include <common/hathreads.h>
+#include <haproxy/thread.h>
 
 #include <types/connection.h>
 #include <types/obj_type.h>
index cb9ff4b24b44f553e4bff1e176813e23f21fcc7f..b0beeb1b6f5ae6b47d762739a44863b9c5694b77 100644 (file)
@@ -25,7 +25,7 @@
 #include <netinet/in.h>
 
 #include <haproxy/api-t.h>
-#include <common/hathreads.h>
+#include <haproxy/thread.h>
 
 #include <types/freq_ctr.h>
 #include <types/listener.h>
index 431420940342c265e680eaffa41f80c6dfbde145..50e208ed9620c38263fdb8393317855f25544cba 100644 (file)
@@ -31,7 +31,7 @@
 #endif
 
 #include <haproxy/list-t.h>
-#include <common/hathreads.h>
+#include <haproxy/thread.h>
 
 #include <types/obj_type.h>
 #include <import/eb32tree.h>
index 301c2bf3329d01d4f9c582ed5c9b742a99b94a63..ae7ce0b2f0b85ece30fba1b0554698355326e87e 100644 (file)
@@ -26,7 +26,7 @@
 #include <sys/un.h>
 #include <netinet/in.h>
 #include <haproxy/api-t.h>
-#include <common/hathreads.h>
+#include <haproxy/thread.h>
 #include <haproxy/list-t.h>
 #include <types/ring.h>
 
index f7bdd30ff43421260c4d321be13d00a7126bc117..aa1ad3583c926eb7b2f276d681b4cecd3d05ac92 100644 (file)
@@ -32,7 +32,7 @@
 #include <common/http.h>
 #include <haproxy/list-t.h>
 #include <common/regex.h>
-#include <common/hathreads.h>
+#include <haproxy/thread.h>
 
 #include <import/eb32tree.h>
 #include <import/ebistree.h>
index 1737f80698a441b43e9bdd0393fca13128d6f6a9..0bc5319df5e15a3703a76ae9ec1519abb22f3bb6 100644 (file)
@@ -26,8 +26,8 @@
 #include <arpa/inet.h>
 
 #include <haproxy/api-t.h>
-#include <haproxy/api.h>
-#include <common/hathreads.h>
+#include <haproxy/list-t.h>
+#include <haproxy/thread.h>
 #include <haproxy/openssl-compat.h>
 
 #include <import/eb32tree.h>
index 85f8b430d2dc3e004fcd2fee71fee41ace93e38c..562e9f21fe8c65061234604f70bf56b0f0147e8e 100644 (file)
@@ -26,7 +26,7 @@
 
 #include <common/buffer.h>
 #include <haproxy/list-t.h>
-#include <common/hathreads.h>
+#include <haproxy/thread.h>
 
 #include <types/filters.h>
 #include <types/freq_ctr.h>
index d62e4ddf9d957b106250e389d7e9156f1684d631..c8a068173e61a6db814e200e5716bd6e20f71c28 100644 (file)
@@ -32,7 +32,7 @@
 #include <types/ssl_crtlist.h>
 
 #include <common/buffer.h>
-#include <common/hathreads.h>
+#include <haproxy/thread.h>
 #include <haproxy/list-t.h>
 #include <haproxy/openssl-compat.h>
 
index 91fcf07279fcb3d55f8c52d5275a2997ca798a05..e7d71d34d92121464dfbcee4adc2f7a17b904564 100644 (file)
@@ -2,7 +2,7 @@
 #define _TYPES_VARS_H
 
 #include <haproxy/list-t.h>
-#include <common/hathreads.h>
+#include <haproxy/thread.h>
 
 #include <types/sample.h>
 
index ceef3559a29b4a226263292d101857222c8e551f..6d3e86f106727021c30d56679ea9c0c226d0ca25 100644 (file)
--- a/src/51d.c
+++ b/src/51d.c
@@ -5,7 +5,7 @@
 #include <common/chunk.h>
 #include <common/buffer.h>
 #include <haproxy/errors.h>
-#include <common/hathreads.h>
+#include <haproxy/thread.h>
 #include <types/global.h>
 #include <proto/arg.h>
 #include <proto/http_fetch.h>
index 6da8f40e96643fd97fc65c150f2a1c7cdb17261c..e9a66fce130564ae42750996e49b6d4538bef2bb 100644 (file)
@@ -13,7 +13,7 @@
 #include <haproxy/api.h>
 #include <common/cfgparse.h>
 #include <common/standard.h>
-#include <common/hathreads.h>
+#include <haproxy/thread-t.h>
 #include <types/activity.h>
 #include <proto/channel.h>
 #include <proto/cli.h>
index 6570ecafe21419fbd5140f75510556ad8fd83706..4decf84c9828fafbae4ad6ce5a827c3489d178f7 100644 (file)
@@ -28,7 +28,7 @@
 #include <haproxy/api.h>
 #include <types/global.h>
 #include <haproxy/errors.h>
-#include <common/hathreads.h>
+#include <haproxy/thread.h>
 
 #include <proto/acl.h>
 #include <proto/log.h>
index da76aa99e52d2bef818860bab15a4730d2fb25b7..f4de78a9b49dc6af1462da44366cc28240543927 100644 (file)
@@ -42,7 +42,7 @@
 #include <common/time.h>
 #include <common/uri_auth.h>
 #include <common/namespace.h>
-#include <common/hathreads.h>
+#include <haproxy/thread.h>
 
 #include <types/capture.h>
 #include <types/filters.h>
index 5dbbecae49ff043ec72ffc582398ff8c926c2a70..92f1e4a2010f75545666ea3040d82cf1164ecfa3 100644 (file)
@@ -36,7 +36,7 @@
 #include <haproxy/list.h>
 #include <common/standard.h>
 #include <common/time.h>
-#include <common/hathreads.h>
+#include <haproxy/thread.h>
 #include <common/http.h>
 #include <common/h1.h>
 #include <common/htx.h>
index 5797a064675e4e576df7fb4ab374c1df9afbee36..a63eeef14c8a11b93c7f79ddd71ccc4e12d12c54 100644 (file)
@@ -28,7 +28,7 @@
 
 #include <haproxy/api.h>
 #include <common/cfgparse.h>
-#include <common/hathreads.h>
+#include <haproxy/thread.h>
 #include <common/memory.h>
 
 #include <types/global.h>
index cf77c5b71b4678a84481c1a3d60697720394b6b1..4017232cebffc1dcf95897d78afb4f4e1421b3d8 100644 (file)
@@ -22,7 +22,7 @@
 #include <haproxy/api.h>
 #include <haproxy/buf.h>
 #include <haproxy/debug.h>
-#include <common/hathreads.h>
+#include <haproxy/thread.h>
 #include <import/ist.h>
 #include <common/net_helper.h>
 #include <common/standard.h>
index 91670afd3190a0c9b3b13542a0b65c8cb89f94ca..132d4876a14038727dde15ed1fc026062e88c2c9 100644 (file)
@@ -15,7 +15,7 @@
 #include <sys/types.h>
 
 #include <haproxy/api.h>
-#include <common/hathreads.h>
+#include <haproxy/thread-t.h>
 #include <common/standard.h>
 #include <common/ticks.h>
 #include <common/time.h>
index c0005e19858919d3583800da0b0ecc5b36e7224d..e440f154472c4b09095c35a27798795a60485fe0 100644 (file)
@@ -19,7 +19,7 @@
 #include <syslog.h>
 
 #include <haproxy/api.h>
-#include <common/hathreads.h>
+#include <haproxy/thread-t.h>
 #include <common/ticks.h>
 #include <common/time.h>
 
index e9821bdf47e9509de2a5d10780733f4037c5e6d1..5b14d51fd3cef9b1132ecf2a00ad4d057ce6ce83 100644 (file)
@@ -18,7 +18,7 @@
 #include <sys/time.h>
 
 #include <haproxy/api.h>
-#include <common/hathreads.h>
+#include <haproxy/thread-t.h>
 #include <common/ticks.h>
 #include <common/time.h>
 
index 0e6dc9445a780bd41f7f90553fe1e76940cb7a9a..c3c52f0db27bcc43f6d45d71487799dc3bc5e5b9 100644 (file)
@@ -18,7 +18,7 @@
 #include <sys/types.h>
 
 #include <haproxy/api.h>
-#include <common/hathreads.h>
+#include <haproxy/thread-t.h>
 #include <common/ticks.h>
 #include <common/time.h>
 
index 9dd93b8873c4763bd873e7af85ed6b14b2e8225d..3b02bed40d82973b5d8c95dcf44afa721220d8d5 100644 (file)
@@ -15,7 +15,7 @@
 #include <sys/types.h>
 
 #include <haproxy/api.h>
-#include <common/hathreads.h>
+#include <haproxy/thread-t.h>
 #include <common/ticks.h>
 #include <common/time.h>
 
index 9bd6ab10aa9da92b2cc877d15ba197a8a5eed03c..7021e556d5a1be468cb19bc9d054afcd96c3587d 100644 (file)
@@ -14,7 +14,7 @@
 
 #include <haproxy/api.h>
 #include <common/cfgparse.h>
-#include <common/hathreads.h>
+#include <haproxy/thread.h>
 #include <common/memory.h>
 #include <common/time.h>
 
index a1dff0c38e1bd9ac93f07b5e3c8ca5d17e96f1fa..b1853cf1bd8fd172ccd3791e1e3dc6fe93f3e68e 100644 (file)
@@ -95,7 +95,7 @@
 #include <common/time.h>
 #include <common/uri_auth.h>
 #include <haproxy/version.h>
-#include <common/hathreads.h>
+#include <haproxy/thread.h>
 
 #include <types/capture.h>
 #include <types/cli.h>
index 15c34cd325140fd15201048ad70a635c498d790b..84fcf8b035b775ab2d6f6bf4e0d12f0b026dd2b6 100644 (file)
@@ -25,7 +25,7 @@
 #include <import/ebpttree.h>
 
 #include <common/cfgparse.h>
-#include <common/hathreads.h>
+#include <haproxy/thread.h>
 #include <common/xref.h>
 #include <common/h1.h>
 
index 2caf13d9c14e2fbc323aa3d129ad763f770046f4..0bca7127815d65190459e8d7a764171998ba29f9 100644 (file)
@@ -18,7 +18,7 @@
 #include <types/stats.h>
 
 #include <common/cfgparse.h>
-#include <common/hathreads.h>
+#include <haproxy/thread.h>
 #include <common/memory.h>
 #include <haproxy/list.h>
 #include <common/standard.h>
index e53076081706d7fb3d1948adde6b36b58e3fe462..6d5a5de61fa8553f780363e8246a9bc724da390f 100644 (file)
@@ -24,7 +24,7 @@
 #include <common/net_helper.h>
 #include <common/time.h>
 #include <common/standard.h>
-#include <common/hathreads.h>
+#include <haproxy/thread.h>
 
 #include <types/global.h>
 #include <types/listener.h>
index b08882087eff06a467a97edeecabbd97e06cc93a..8c828214a09425d4a12019f12b0d6430658771fd 100644 (file)
@@ -14,7 +14,7 @@
 #include <fcntl.h>
 
 #include <haproxy/api.h>
-#include <common/hathreads.h>
+#include <haproxy/thread.h>
 #include <common/memory.h>
 
 #include <types/global.h>
index 3c5007687907605e71af70a2a0442947c4ac23e3..f2407ed671290108da93d58452ddf87fa8118fc0 100644 (file)
@@ -72,7 +72,7 @@
 #include <haproxy/api.h>
 #include <common/memory.h>
 #include <common/time.h>
-#include <common/hathreads.h>
+#include <haproxy/thread.h>
 #include <import/eb32tree.h>
 
 #include <proto/http_rules.h>
index d10ebd75fe7a52a4c1528dc8fc608349cf7ff468..ee72bb15752604e586280638500e5ab7efe85fc5 100644 (file)
@@ -21,7 +21,7 @@
 #include <stdlib.h>
 #include <haproxy/api.h>
 #include <haproxy/buf.h>
-#include <common/hathreads.h>
+#include <haproxy/thread.h>
 #include <types/applet.h>
 #include <proto/cli.h>
 #include <proto/ring.h>
index 0c030379c80688dfbb9134fc214f972801ab7616..7b5620f9734a299f0ae5e4011823780aa0f19b5c 100644 (file)
@@ -17,7 +17,7 @@
 #include <haproxy/api.h>
 #include <common/cfgparse.h>
 #include <common/buffer.h>
-#include <common/hathreads.h>
+#include <haproxy/thread.h>
 #include <common/htx.h>
 #include <common/memory.h>
 
similarity index 99%
rename from src/hathreads.c
rename to src/thread.c
index 14c5658978d3fbbaf6575447acea86fb8eedde27..47c5ab9dd3d2ec3c28e5c487d83f5afb5244de11 100644 (file)
@@ -24,7 +24,7 @@
 #endif
 
 #include <common/cfgparse.h>
-#include <common/hathreads.h>
+#include <haproxy/thread.h>
 #include <common/standard.h>
 #include <types/global.h>
 #include <proto/fd.h>
@@ -190,7 +190,7 @@ static int thread_cpus_enabled()
 }
 
 __attribute__((constructor))
-static void __hathreads_init(void)
+static void __thread_init(void)
 {
        char *ptr = NULL;
 
index 5c8ed4be2564647516784a172f7f2468ffbe9722..86c2469878ddfeb9d4442ebd50e241d1252180a1 100644 (file)
@@ -16,7 +16,7 @@
 #include <haproxy/api.h>
 #include <common/standard.h>
 #include <common/time.h>
-#include <common/hathreads.h>
+#include <haproxy/thread-t.h>
 
 THREAD_LOCAL unsigned int   ms_left_scaled;  /* milliseconds left for current second (0..2^32-1) */
 THREAD_LOCAL unsigned int   now_ms;          /* internal date in milliseconds (may wrap) */
index 2d03b4a1f2710ced0cb29b3d50abc0ece1b0f80b..86de286404168b25a7f96d6c0eaa7159649c3535 100644 (file)
--- a/src/wdt.c
+++ b/src/wdt.c
@@ -14,7 +14,7 @@
 
 #include <haproxy/api.h>
 #include <haproxy/debug.h>
-#include <common/hathreads.h>
+#include <haproxy/thread.h>
 #include <common/standard.h>
 #include <types/global.h>
 #include <types/signal.h>