MINOR: threads: Use __decl_hathreads to declare locks

This macro should be used to declare variables or struct members depending on
the USE_THREAD compile option. It avoids the encapsulation of such declarations
between #ifdef/#endif. It is used to declare all lock variables.
diff --git a/src/applet.c b/src/applet.c
index 0e550c2..1df6b09 100644
--- a/src/applet.c
+++ b/src/applet.c
@@ -22,10 +22,7 @@
 
 unsigned int nb_applets = 0;
 unsigned int applets_active_queue = 0;
-
-#ifdef USE_THREAD
-HA_SPINLOCK_T applet_active_lock;        /* spin lock related to applet active queue */
-#endif
+__decl_hathreads(HA_SPINLOCK_T applet_active_lock);  /* spin lock related to applet active queue */
 
 struct list applet_active_queue = LIST_HEAD_INIT(applet_active_queue);
 
diff --git a/src/buffer.c b/src/buffer.c
index b365888..66d117a 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -33,9 +33,7 @@
 
 /* list of objects waiting for at least one buffer */
 struct list buffer_wq = LIST_HEAD_INIT(buffer_wq);
-#ifdef USE_THREAD
-HA_SPINLOCK_T buffer_wq_lock;
-#endif
+__decl_hathreads(HA_SPINLOCK_T buffer_wq_lock);
 
 /* this buffer is always the same size as standard buffers and is used for
  * swapping data inside a buffer.
diff --git a/src/checks.c b/src/checks.c
index 8d5822a..4b47cf3 100644
--- a/src/checks.c
+++ b/src/checks.c
@@ -1613,9 +1613,7 @@
 
 static struct list pid_list = LIST_HEAD_INIT(pid_list);
 static struct pool_head *pool2_pid_list;
-#ifdef USE_THREAD
-HA_SPINLOCK_T pid_list_lock;
-#endif
+__decl_hathreads(HA_SPINLOCK_T pid_list_lock);
 
 void block_sigchld(void)
 {
diff --git a/src/compression.c b/src/compression.c
index 594399a..4961ef3 100644
--- a/src/compression.c
+++ b/src/compression.c
@@ -42,9 +42,7 @@
 
 
 #if defined(USE_SLZ) || defined(USE_ZLIB)
-#ifdef USE_THREAD
-static HA_SPINLOCK_T comp_pool_lock;
-#endif
+__decl_hathreads(static HA_SPINLOCK_T comp_pool_lock);
 #endif
 
 #ifdef USE_ZLIB
diff --git a/src/fd.c b/src/fd.c
index d2e9569..9fb09ab 100644
--- a/src/fd.c
+++ b/src/fd.c
@@ -174,11 +174,9 @@
 THREAD_LOCAL int *fd_updt  = NULL;  // FD updates list
 THREAD_LOCAL int  fd_nbupdt = 0;   // number of updates in the list
 
-#ifdef USE_THREAD
-HA_SPINLOCK_T fdtab_lock;       /* global lock to protect fdtab array */
-HA_RWLOCK_T   fdcache_lock;     /* global lock to protect fd_cache array */
-HA_SPINLOCK_T poll_lock;        /* global lock to protect poll info */
-#endif
+__decl_hathreads(HA_SPINLOCK_T fdtab_lock);       /* global lock to protect fdtab array */
+__decl_hathreads(HA_RWLOCK_T   fdcache_lock);     /* global lock to protect fd_cache array */
+__decl_hathreads(HA_SPINLOCK_T poll_lock);        /* global lock to protect poll info */
 
 /* Deletes an FD from the fdsets, and recomputes the maxfd limit.
  * The file descriptor is also closed.
diff --git a/src/hlua.c b/src/hlua.c
index 439bbf4..dbdc975 100644
--- a/src/hlua.c
+++ b/src/hlua.c
@@ -115,9 +115,7 @@
  * and RESET_SAFE_LJMP manipulates the Lua stack, so it will be careful
  * to set mutex around these functions.
  */
-#ifdef USE_THREAD
-HA_SPINLOCK_T hlua_global_lock;
-#endif
+__decl_hathreads(HA_SPINLOCK_T hlua_global_lock);
 THREAD_LOCAL jmp_buf safe_ljmp_env;
 static int hlua_panic_safe(lua_State *L) { return 0; }
 static int hlua_panic_ljmp(lua_State *L) { longjmp(safe_ljmp_env, 1); }
diff --git a/src/listener.c b/src/listener.c
index a6bd449..c7db79a 100644
--- a/src/listener.c
+++ b/src/listener.c
@@ -38,10 +38,8 @@
 #include <proto/stream.h>
 #include <proto/task.h>
 
-#ifdef USE_THREAD
  /* listner_queue lock (same for global and per proxy queues) */
-static HA_SPINLOCK_T lq_lock;
-#endif
+__decl_hathreads(static HA_SPINLOCK_T lq_lock);
 
 /* List head of all known bind keywords */
 static struct bind_kw_list bind_keywords = {
diff --git a/src/pattern.c b/src/pattern.c
index 47e8aee..fe672f1 100644
--- a/src/pattern.c
+++ b/src/pattern.c
@@ -155,9 +155,7 @@
 struct list pattern_reference = LIST_HEAD_INIT(pattern_reference);
 
 static struct lru64_head *pat_lru_tree;
-#ifdef USE_THREAD
-HA_SPINLOCK_T pat_lru_tree_lock;
-#endif
+__decl_hathreads(HA_SPINLOCK_T pat_lru_tree_lock);
 static unsigned long long pat_lru_seed;
 
 /*
diff --git a/src/pipe.c b/src/pipe.c
index c161f96..bab8620 100644
--- a/src/pipe.c
+++ b/src/pipe.c
@@ -22,9 +22,9 @@
 
 struct pool_head *pool2_pipe = NULL;
 struct pipe *pipes_live = NULL; /* pipes which are still ready to use */
-#ifdef USE_THREAD
-HA_SPINLOCK_T pipes_lock;       /* lock used to protect pipes list */
-#endif
+
+__decl_hathreads(HA_SPINLOCK_T pipes_lock); /* lock used to protect pipes list */
+
 int pipes_used = 0;             /* # of pipes in use (2 fds each) */
 int pipes_free = 0;             /* # of pipes unused */
 
diff --git a/src/server.c b/src/server.c
index d79e951..5e995f8 100644
--- a/src/server.c
+++ b/src/server.c
@@ -45,10 +45,7 @@
 #include <netinet/tcp.h>
 
 struct list updated_servers = LIST_HEAD_INIT(updated_servers);
-
-#ifdef USE_THREAD
-HA_SPINLOCK_T updated_servers_lock;
-#endif
+__decl_hathreads(HA_SPINLOCK_T updated_servers_lock);
 
 static void srv_register_update(struct server *srv);
 static void srv_update_state(struct server *srv, int version, char **params);
diff --git a/src/signal.c b/src/signal.c
index 3409e76..e996c46 100644
--- a/src/signal.c
+++ b/src/signal.c
@@ -31,9 +31,7 @@
 sigset_t blocked_sig;
 int signal_pending = 0; /* non-zero if t least one signal remains unprocessed */
 
-#ifdef USE_THREAD
-HA_SPINLOCK_T signals_lock;
-#endif
+__decl_hathreads(HA_SPINLOCK_T signals_lock);
 
 /* Common signal handler, used by all signals. Received signals are queued.
  * Signal number zero has a specific status, as it cannot be delivered by the
diff --git a/src/ssl_sock.c b/src/ssl_sock.c
index 72d9b8a..25f3eca 100644
--- a/src/ssl_sock.c
+++ b/src/ssl_sock.c
@@ -206,6 +206,7 @@
 };
 
 #ifdef USE_THREAD
+
 static HA_RWLOCK_T *ssl_rwlocks;
 
 
@@ -246,6 +247,7 @@
 
 	return 0;
 }
+
 #endif
 
 
@@ -302,10 +304,7 @@
 static struct lru64_head *ssl_ctx_lru_tree = NULL;
 static unsigned int       ssl_ctx_lru_seed = 0;
 static unsigned int	  ssl_ctx_serial;
-
-#ifdef USE_THREAD
-static HA_RWLOCK_T ssl_ctx_lru_rwlock;
-#endif
+__decl_hathreads(static HA_RWLOCK_T ssl_ctx_lru_rwlock);
 
 #endif // SSL_CTRL_SET_TLSEXT_HOSTNAME
 
diff --git a/src/stream.c b/src/stream.c
index 19d94f3..d71b6ce 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -62,10 +62,8 @@
 
 struct pool_head *pool2_stream;
 struct list streams;
+__decl_hathreads(HA_SPINLOCK_T streams_lock);
 
-#ifdef USE_THREAD
-HA_SPINLOCK_T streams_lock;
-#endif
 /* List of all use-service keywords. */
 static struct list service_keywords = LIST_HEAD_INIT(service_keywords);
 
diff --git a/src/task.c b/src/task.c
index 9882903..4f9b049 100644
--- a/src/task.c
+++ b/src/task.c
@@ -37,10 +37,8 @@
 unsigned int nb_tasks_cur = 0;     /* copy of the tasks count */
 unsigned int niced_tasks = 0;      /* number of niced tasks in the run queue */
 
-#ifdef USE_THREAD
-HA_SPINLOCK_T rq_lock;        /* spin lock related to run queue */
-HA_SPINLOCK_T wq_lock;        /* spin lock related to wait queue */
-#endif
+__decl_hathreads(HA_SPINLOCK_T rq_lock); /* spin lock related to run queue */
+__decl_hathreads(HA_SPINLOCK_T wq_lock); /* spin lock related to wait queue */
 
 static struct eb_root timers;      /* sorted timers tree */
 static struct eb_root rqueue;      /* tree constituting the run queue */
diff --git a/src/vars.c b/src/vars.c
index fef3685..2192fa5 100644
--- a/src/vars.c
+++ b/src/vars.c
@@ -32,9 +32,7 @@
 static unsigned int var_reqres_limit = 0;
 
 
-#ifdef USE_THREAD
-HA_RWLOCK_T   var_names_rwlock;
-#endif
+__decl_hathreads(HA_RWLOCK_T var_names_rwlock);
 
 /* This function adds or remove memory size from the accounting. The inner
  * pointers may be null when setting the outer ones only.