BUILD: threads: Rename SPIN/RWLOCK macros using HA_ prefix

This remove any name conflicts, especially on Solaris.
diff --git a/include/proto/applet.h b/include/proto/applet.h
index 51a7e26..1a621a1 100644
--- a/include/proto/applet.h
+++ b/include/proto/applet.h
@@ -88,10 +88,10 @@
 	}
 
 	if (!LIST_ISEMPTY(&appctx->buffer_wait.list)) {
-		SPIN_LOCK(BUF_WQ_LOCK, &buffer_wq_lock);
+		HA_SPIN_LOCK(BUF_WQ_LOCK, &buffer_wq_lock);
 		LIST_DEL(&appctx->buffer_wait.list);
 		LIST_INIT(&appctx->buffer_wait.list);
-		SPIN_UNLOCK(BUF_WQ_LOCK, &buffer_wq_lock);
+		HA_SPIN_UNLOCK(BUF_WQ_LOCK, &buffer_wq_lock);
 	}
 
 	pool_free2(pool2_connection, appctx);
@@ -99,14 +99,14 @@
 }
 static inline void appctx_free(struct appctx *appctx)
 {
-	SPIN_LOCK(APPLETS_LOCK, &applet_active_lock);
+	HA_SPIN_LOCK(APPLETS_LOCK, &applet_active_lock);
 	if (appctx->state & APPLET_RUNNING) {
 		appctx->state |= APPLET_WANT_DIE;
-		SPIN_UNLOCK(APPLETS_LOCK, &applet_active_lock);
+		HA_SPIN_UNLOCK(APPLETS_LOCK, &applet_active_lock);
 		return;
 	}
 	__appctx_free(appctx);
-	SPIN_UNLOCK(APPLETS_LOCK, &applet_active_lock);
+	HA_SPIN_UNLOCK(APPLETS_LOCK, &applet_active_lock);
 }
 
 /* wakes up an applet when conditions have changed */
@@ -120,14 +120,14 @@
 
 static inline void appctx_wakeup(struct appctx *appctx)
 {
-	SPIN_LOCK(APPLETS_LOCK, &applet_active_lock);
+	HA_SPIN_LOCK(APPLETS_LOCK, &applet_active_lock);
 	if (appctx->state & APPLET_RUNNING) {
 		appctx->state |= APPLET_WOKEN_UP;
-		SPIN_UNLOCK(APPLETS_LOCK, &applet_active_lock);
+		HA_SPIN_UNLOCK(APPLETS_LOCK, &applet_active_lock);
 		return;
 	}
 	__appctx_wakeup(appctx);
-	SPIN_UNLOCK(APPLETS_LOCK, &applet_active_lock);
+	HA_SPIN_UNLOCK(APPLETS_LOCK, &applet_active_lock);
 }
 
 /* Callback used to wake up an applet when a buffer is available. The applet
@@ -137,18 +137,18 @@
  * requested */
 static inline int appctx_res_wakeup(struct appctx *appctx)
 {
-	SPIN_LOCK(APPLETS_LOCK, &applet_active_lock);
+	HA_SPIN_LOCK(APPLETS_LOCK, &applet_active_lock);
 	if (appctx->state & APPLET_RUNNING) {
 		if (appctx->state & APPLET_WOKEN_UP) {
-			SPIN_UNLOCK(APPLETS_LOCK, &applet_active_lock);
+			HA_SPIN_UNLOCK(APPLETS_LOCK, &applet_active_lock);
 			return 0;
 		}
 		appctx->state |= APPLET_WOKEN_UP;
-		SPIN_UNLOCK(APPLETS_LOCK, &applet_active_lock);
+		HA_SPIN_UNLOCK(APPLETS_LOCK, &applet_active_lock);
 		return 1;
 	}
 	__appctx_wakeup(appctx);
-	SPIN_UNLOCK(APPLETS_LOCK, &applet_active_lock);
+	HA_SPIN_UNLOCK(APPLETS_LOCK, &applet_active_lock);
 	return 1;
 }
 
diff --git a/include/proto/channel.h b/include/proto/channel.h
index 83ad0aa..d6f355e 100644
--- a/include/proto/channel.h
+++ b/include/proto/channel.h
@@ -441,9 +441,9 @@
 		return 1;
 
 	if (LIST_ISEMPTY(&wait->list)) {
-		SPIN_LOCK(BUF_WQ_LOCK, &buffer_wq_lock);
+		HA_SPIN_LOCK(BUF_WQ_LOCK, &buffer_wq_lock);
 		LIST_ADDQ(&buffer_wq, &wait->list);
-		SPIN_UNLOCK(BUF_WQ_LOCK, &buffer_wq_lock);
+		HA_SPIN_UNLOCK(BUF_WQ_LOCK, &buffer_wq_lock);
 	}
 
 	return 0;
diff --git a/include/proto/checks.h b/include/proto/checks.h
index b0b8c7d..2b285f3 100644
--- a/include/proto/checks.h
+++ b/include/proto/checks.h
@@ -37,15 +37,15 @@
  */
 static inline void health_adjust(struct server *s, short status)
 {
-	SPIN_LOCK(SERVER_LOCK, &s->lock);
+	HA_SPIN_LOCK(SERVER_LOCK, &s->lock);
 	/* return now if observing nor health check is not enabled */
 	if (!s->observe || !s->check.task) {
-		SPIN_UNLOCK(SERVER_LOCK, &s->lock);
+		HA_SPIN_UNLOCK(SERVER_LOCK, &s->lock);
 		return;
 	}
 
 	__health_adjust(s, status);
-	SPIN_UNLOCK(SERVER_LOCK, &s->lock);
+	HA_SPIN_UNLOCK(SERVER_LOCK, &s->lock);
 }
 
 const char *init_check(struct check *check, int type);
diff --git a/include/proto/fd.h b/include/proto/fd.h
index e240f5c..813e4f3 100644
--- a/include/proto/fd.h
+++ b/include/proto/fd.h
@@ -113,14 +113,14 @@
  */
 static inline void fd_alloc_cache_entry(const int fd)
 {
-	RWLOCK_WRLOCK(FDCACHE_LOCK, &fdcache_lock);
+	HA_RWLOCK_WRLOCK(FDCACHE_LOCK, &fdcache_lock);
 	if (fdtab[fd].cache)
 		goto end;
 	fd_cache_num++;
 	fdtab[fd].cache = fd_cache_num;
 	fd_cache[fd_cache_num-1] = fd;
   end:
-	RWLOCK_WRUNLOCK(FDCACHE_LOCK, &fdcache_lock);
+	HA_RWLOCK_WRUNLOCK(FDCACHE_LOCK, &fdcache_lock);
 }
 
 /* Removes entry used by fd <fd> from the FD cache and replaces it with the
@@ -131,7 +131,7 @@
 {
 	unsigned int pos;
 
-	RWLOCK_WRLOCK(FDCACHE_LOCK, &fdcache_lock);
+	HA_RWLOCK_WRLOCK(FDCACHE_LOCK, &fdcache_lock);
 	pos = fdtab[fd].cache;
 	if (!pos)
 		goto end;
@@ -144,7 +144,7 @@
 		fdtab[fd].cache = pos;
 	}
   end:
-	RWLOCK_WRUNLOCK(FDCACHE_LOCK, &fdcache_lock);
+	HA_RWLOCK_WRUNLOCK(FDCACHE_LOCK, &fdcache_lock);
 }
 
 /* Computes the new polled status based on the active and ready statuses, for
@@ -267,56 +267,56 @@
 /* Disable processing recv events on fd <fd> */
 static inline void fd_stop_recv(int fd)
 {
-	SPIN_LOCK(FD_LOCK, &fdtab[fd].lock);
+	HA_SPIN_LOCK(FD_LOCK, &fdtab[fd].lock);
 	if (fd_recv_active(fd)) {
 		fdtab[fd].state &= ~FD_EV_ACTIVE_R;
 		fd_update_cache(fd); /* need an update entry to change the state */
 	}
-	SPIN_UNLOCK(FD_LOCK, &fdtab[fd].lock);
+	HA_SPIN_UNLOCK(FD_LOCK, &fdtab[fd].lock);
 }
 
 /* Disable processing send events on fd <fd> */
 static inline void fd_stop_send(int fd)
 {
-	SPIN_LOCK(FD_LOCK, &fdtab[fd].lock);
+	HA_SPIN_LOCK(FD_LOCK, &fdtab[fd].lock);
 	if (fd_send_active(fd)) {
 		fdtab[fd].state &= ~FD_EV_ACTIVE_W;
 		fd_update_cache(fd); /* need an update entry to change the state */
 	}
-	SPIN_UNLOCK(FD_LOCK, &fdtab[fd].lock);
+	HA_SPIN_UNLOCK(FD_LOCK, &fdtab[fd].lock);
 }
 
 /* Disable processing of events on fd <fd> for both directions. */
 static inline void fd_stop_both(int fd)
 {
-	SPIN_LOCK(FD_LOCK, &fdtab[fd].lock);
+	HA_SPIN_LOCK(FD_LOCK, &fdtab[fd].lock);
 	if (fd_active(fd)) {
 		fdtab[fd].state &= ~FD_EV_ACTIVE_RW;
 		fd_update_cache(fd); /* need an update entry to change the state */
 	}
-	SPIN_UNLOCK(FD_LOCK, &fdtab[fd].lock);
+	HA_SPIN_UNLOCK(FD_LOCK, &fdtab[fd].lock);
 }
 
 /* Report that FD <fd> cannot receive anymore without polling (EAGAIN detected). */
 static inline void fd_cant_recv(const int fd)
 {
-	SPIN_LOCK(FD_LOCK, &fdtab[fd].lock);
+	HA_SPIN_LOCK(FD_LOCK, &fdtab[fd].lock);
 	if (fd_recv_ready(fd)) {
 		fdtab[fd].state &= ~FD_EV_READY_R;
 		fd_update_cache(fd); /* need an update entry to change the state */
 	}
-	SPIN_UNLOCK(FD_LOCK, &fdtab[fd].lock);
+	HA_SPIN_UNLOCK(FD_LOCK, &fdtab[fd].lock);
 }
 
 /* Report that FD <fd> can receive anymore without polling. */
 static inline void fd_may_recv(const int fd)
 {
-	SPIN_LOCK(FD_LOCK, &fdtab[fd].lock);
+	HA_SPIN_LOCK(FD_LOCK, &fdtab[fd].lock);
 	if (!fd_recv_ready(fd)) {
 		fdtab[fd].state |= FD_EV_READY_R;
 		fd_update_cache(fd); /* need an update entry to change the state */
 	}
-	SPIN_UNLOCK(FD_LOCK, &fdtab[fd].lock);
+	HA_SPIN_UNLOCK(FD_LOCK, &fdtab[fd].lock);
 }
 
 /* Disable readiness when polled. This is useful to interrupt reading when it
@@ -326,66 +326,66 @@
  */
 static inline void fd_done_recv(const int fd)
 {
-	SPIN_LOCK(FD_LOCK, &fdtab[fd].lock);
+	HA_SPIN_LOCK(FD_LOCK, &fdtab[fd].lock);
 	if (fd_recv_polled(fd) && fd_recv_ready(fd)) {
 		fdtab[fd].state &= ~FD_EV_READY_R;
 		fd_update_cache(fd); /* need an update entry to change the state */
 	}
-	SPIN_UNLOCK(FD_LOCK, &fdtab[fd].lock);
+	HA_SPIN_UNLOCK(FD_LOCK, &fdtab[fd].lock);
 }
 
 /* Report that FD <fd> cannot send anymore without polling (EAGAIN detected). */
 static inline void fd_cant_send(const int fd)
 {
-	SPIN_LOCK(FD_LOCK, &fdtab[fd].lock);
+	HA_SPIN_LOCK(FD_LOCK, &fdtab[fd].lock);
 	if (fd_send_ready(fd)) {
 		fdtab[fd].state &= ~FD_EV_READY_W;
 		fd_update_cache(fd); /* need an update entry to change the state */
 	}
-	SPIN_UNLOCK(FD_LOCK, &fdtab[fd].lock);
+	HA_SPIN_UNLOCK(FD_LOCK, &fdtab[fd].lock);
 }
 
 /* Report that FD <fd> can send anymore without polling (EAGAIN detected). */
 static inline void fd_may_send(const int fd)
 {
-	SPIN_LOCK(FD_LOCK, &fdtab[fd].lock);
+	HA_SPIN_LOCK(FD_LOCK, &fdtab[fd].lock);
 	if (!fd_send_ready(fd)) {
 		fdtab[fd].state |= FD_EV_READY_W;
 		fd_update_cache(fd); /* need an update entry to change the state */
 	}
-	SPIN_UNLOCK(FD_LOCK, &fdtab[fd].lock);
+	HA_SPIN_UNLOCK(FD_LOCK, &fdtab[fd].lock);
 }
 
 /* Prepare FD <fd> to try to receive */
 static inline void fd_want_recv(int fd)
 {
-	SPIN_LOCK(FD_LOCK, &fdtab[fd].lock);
+	HA_SPIN_LOCK(FD_LOCK, &fdtab[fd].lock);
 	if (!fd_recv_active(fd)) {
 		fdtab[fd].state |= FD_EV_ACTIVE_R;
 		fd_update_cache(fd); /* need an update entry to change the state */
 	}
-	SPIN_UNLOCK(FD_LOCK, &fdtab[fd].lock);
+	HA_SPIN_UNLOCK(FD_LOCK, &fdtab[fd].lock);
 }
 
 /* Prepare FD <fd> to try to send */
 static inline void fd_want_send(int fd)
 {
-	SPIN_LOCK(FD_LOCK, &fdtab[fd].lock);
+	HA_SPIN_LOCK(FD_LOCK, &fdtab[fd].lock);
 	if (!fd_send_active(fd)) {
 		fdtab[fd].state |= FD_EV_ACTIVE_W;
 		fd_update_cache(fd); /* need an update entry to change the state */
 	}
-	SPIN_UNLOCK(FD_LOCK, &fdtab[fd].lock);
+	HA_SPIN_UNLOCK(FD_LOCK, &fdtab[fd].lock);
 }
 
 /* Update events seen for FD <fd> and its state if needed. This should be called
  * by the poller to set FD_POLL_* flags. */
 static inline void fd_update_events(int fd, int evts)
 {
-	SPIN_LOCK(FD_LOCK, &fdtab[fd].lock);
+	HA_SPIN_LOCK(FD_LOCK, &fdtab[fd].lock);
 	fdtab[fd].ev &= FD_POLL_STICKY;
 	fdtab[fd].ev |= evts;
-	SPIN_UNLOCK(FD_LOCK, &fdtab[fd].lock);
+	HA_SPIN_UNLOCK(FD_LOCK, &fdtab[fd].lock);
 
 	if (fdtab[fd].ev & (FD_POLL_IN | FD_POLL_HUP | FD_POLL_ERR))
 		fd_may_recv(fd);
@@ -397,7 +397,7 @@
 /* Prepares <fd> for being polled */
 static inline void fd_insert(int fd, unsigned long thread_mask)
 {
-	SPIN_LOCK(FD_LOCK, &fdtab[fd].lock);
+	HA_SPIN_LOCK(FD_LOCK, &fdtab[fd].lock);
 	fdtab[fd].ev = 0;
 	fdtab[fd].new = 1;
 	fdtab[fd].updated = 0;
@@ -405,12 +405,12 @@
 	fdtab[fd].cloned = 0;
 	fdtab[fd].cache = 0;
 	fdtab[fd].thread_mask = thread_mask;
-	SPIN_UNLOCK(FD_LOCK, &fdtab[fd].lock);
+	HA_SPIN_UNLOCK(FD_LOCK, &fdtab[fd].lock);
 
-	SPIN_LOCK(FDTAB_LOCK, &fdtab_lock);
+	HA_SPIN_LOCK(FDTAB_LOCK, &fdtab_lock);
 	if (fd + 1 > maxfd)
 		maxfd = fd + 1;
-	SPIN_UNLOCK(FDTAB_LOCK, &fdtab_lock);
+	HA_SPIN_UNLOCK(FDTAB_LOCK, &fdtab_lock);
 }
 
 
diff --git a/include/proto/session.h b/include/proto/session.h
index 3dead44..7f95e2a 100644
--- a/include/proto/session.h
+++ b/include/proto/session.h
@@ -57,11 +57,11 @@
 
 		ptr = stktable_data_ptr(stkctr->table, ts, STKTABLE_DT_CONN_CUR);
 		if (ptr) {
-			RWLOCK_WRLOCK(STK_SESS_LOCK, &ts->lock);
+			HA_RWLOCK_WRLOCK(STK_SESS_LOCK, &ts->lock);
 
 			stktable_data_cast(ptr, conn_cur)--;
 
-			RWLOCK_WRUNLOCK(STK_SESS_LOCK, &ts->lock);
+			HA_RWLOCK_WRUNLOCK(STK_SESS_LOCK, &ts->lock);
 		}
 
 		stkctr_set_entry(stkctr, NULL);
diff --git a/include/proto/stick_table.h b/include/proto/stick_table.h
index 4e92538..59674f6 100644
--- a/include/proto/stick_table.h
+++ b/include/proto/stick_table.h
@@ -141,7 +141,7 @@
 
 static inline void stksess_kill_if_expired(struct stktable *t, struct stksess *ts, int decrefcnt)
 {
-	SPIN_LOCK(STK_TABLE_LOCK, &t->lock);
+	HA_SPIN_LOCK(STK_TABLE_LOCK, &t->lock);
 
 	if (decrefcnt)
 		ts->ref_cnt--;
@@ -149,7 +149,7 @@
 	if (t->expire != TICK_ETERNITY && tick_is_expired(ts->expire, now_ms))
 		__stksess_kill_if_expired(t, ts);
 
-	SPIN_UNLOCK(STK_TABLE_LOCK, &t->lock);
+	HA_SPIN_UNLOCK(STK_TABLE_LOCK, &t->lock);
 }
 
 /* sets the stick counter's entry pointer */
diff --git a/include/proto/stream.h b/include/proto/stream.h
index f0edc2e..1a31930 100644
--- a/include/proto/stream.h
+++ b/include/proto/stream.h
@@ -102,11 +102,11 @@
 
 		ptr = stktable_data_ptr(s->stkctr[i].table, ts, STKTABLE_DT_CONN_CUR);
 		if (ptr) {
-			RWLOCK_WRLOCK(STK_SESS_LOCK, &ts->lock);
+			HA_RWLOCK_WRLOCK(STK_SESS_LOCK, &ts->lock);
 
 			stktable_data_cast(ptr, conn_cur)--;
 
-			RWLOCK_WRUNLOCK(STK_SESS_LOCK, &ts->lock);
+			HA_RWLOCK_WRUNLOCK(STK_SESS_LOCK, &ts->lock);
 		}
 		stkctr_set_entry(&s->stkctr[i], NULL);
 		stksess_kill_if_expired(s->stkctr[i].table, ts, 1);
@@ -137,11 +137,11 @@
 
 		ptr = stktable_data_ptr(s->stkctr[i].table, ts, STKTABLE_DT_CONN_CUR);
 		if (ptr) {
-			RWLOCK_WRLOCK(STK_SESS_LOCK, &ts->lock);
+			HA_RWLOCK_WRLOCK(STK_SESS_LOCK, &ts->lock);
 
 			stktable_data_cast(ptr, conn_cur)--;
 
-			RWLOCK_WRUNLOCK(STK_SESS_LOCK, &ts->lock);
+			HA_RWLOCK_WRUNLOCK(STK_SESS_LOCK, &ts->lock);
 		}
 		stkctr_set_entry(&s->stkctr[i], NULL);
 		stksess_kill_if_expired(s->stkctr[i].table, ts, 1);
@@ -156,7 +156,7 @@
 {
 	void *ptr;
 
-	RWLOCK_WRLOCK(STK_SESS_LOCK, &ts->lock);
+	HA_RWLOCK_WRLOCK(STK_SESS_LOCK, &ts->lock);
 
 	ptr = stktable_data_ptr(t, ts, STKTABLE_DT_CONN_CUR);
 	if (ptr)
@@ -173,7 +173,7 @@
 	if (tick_isset(t->expire))
 		ts->expire = tick_add(now_ms, MS_TO_TICKS(t->expire));
 
-	RWLOCK_WRUNLOCK(STK_SESS_LOCK, &ts->lock);
+	HA_RWLOCK_WRUNLOCK(STK_SESS_LOCK, &ts->lock);
 }
 
 /* Enable tracking of stream counters as <stkctr> on stksess <ts>. The caller is
@@ -209,7 +209,7 @@
 				continue;
 		}
 
-		RWLOCK_WRLOCK(STK_SESS_LOCK, &ts->lock);
+		HA_RWLOCK_WRLOCK(STK_SESS_LOCK, &ts->lock);
 
 		ptr = stktable_data_ptr(stkctr->table, ts, STKTABLE_DT_HTTP_REQ_CNT);
 		if (ptr)
@@ -220,7 +220,7 @@
 			update_freq_ctr_period(&stktable_data_cast(ptr, http_req_rate),
 					       stkctr->table->data_arg[STKTABLE_DT_HTTP_REQ_RATE].u, 1);
 
-		RWLOCK_WRUNLOCK(STK_SESS_LOCK, &ts->lock);
+		HA_RWLOCK_WRUNLOCK(STK_SESS_LOCK, &ts->lock);
 	}
 }
 
@@ -243,7 +243,7 @@
 		if (!(stkctr_flags(&s->stkctr[i]) & STKCTR_TRACK_BACKEND))
 			continue;
 
-		RWLOCK_WRLOCK(STK_SESS_LOCK, &ts->lock);
+		HA_RWLOCK_WRLOCK(STK_SESS_LOCK, &ts->lock);
 
 		ptr = stktable_data_ptr(stkctr->table, ts, STKTABLE_DT_HTTP_REQ_CNT);
 		if (ptr)
@@ -254,7 +254,7 @@
 			update_freq_ctr_period(&stktable_data_cast(ptr, http_req_rate),
 			                       stkctr->table->data_arg[STKTABLE_DT_HTTP_REQ_RATE].u, 1);
 
-		RWLOCK_WRUNLOCK(STK_SESS_LOCK, &ts->lock);
+		HA_RWLOCK_WRUNLOCK(STK_SESS_LOCK, &ts->lock);
 	}
 }
 
@@ -281,7 +281,7 @@
 				continue;
 		}
 
-		RWLOCK_WRLOCK(STK_SESS_LOCK, &ts->lock);
+		HA_RWLOCK_WRLOCK(STK_SESS_LOCK, &ts->lock);
 
 		ptr = stktable_data_ptr(stkctr->table, ts, STKTABLE_DT_HTTP_ERR_CNT);
 		if (ptr)
@@ -292,16 +292,16 @@
 			update_freq_ctr_period(&stktable_data_cast(ptr, http_err_rate),
 			                       stkctr->table->data_arg[STKTABLE_DT_HTTP_ERR_RATE].u, 1);
 
-		RWLOCK_WRUNLOCK(STK_SESS_LOCK, &ts->lock);
+		HA_RWLOCK_WRUNLOCK(STK_SESS_LOCK, &ts->lock);
 	}
 }
 
 static void inline stream_add_srv_conn(struct stream *sess, struct server *srv)
 {
-	SPIN_LOCK(SERVER_LOCK, &srv->lock);
+	HA_SPIN_LOCK(SERVER_LOCK, &srv->lock);
 	sess->srv_conn = srv;
 	LIST_ADD(&srv->actconns, &sess->by_srv);
-	SPIN_UNLOCK(SERVER_LOCK, &srv->lock);
+	HA_SPIN_UNLOCK(SERVER_LOCK, &srv->lock);
 }
 
 static void inline stream_del_srv_conn(struct stream *sess)
@@ -311,10 +311,10 @@
 	if (!srv)
 		return;
 
-	SPIN_LOCK(SERVER_LOCK, &srv->lock);
+	HA_SPIN_LOCK(SERVER_LOCK, &srv->lock);
 	sess->srv_conn = NULL;
 	LIST_DEL(&sess->by_srv);
-	SPIN_UNLOCK(SERVER_LOCK, &srv->lock);
+	HA_SPIN_UNLOCK(SERVER_LOCK, &srv->lock);
 }
 
 static void inline stream_init_srv_conn(struct stream *sess)
diff --git a/include/proto/task.h b/include/proto/task.h
index 24edaac..e6ba461 100644
--- a/include/proto/task.h
+++ b/include/proto/task.h
@@ -110,20 +110,20 @@
 struct task *__task_wakeup(struct task *t);
 static inline struct task *task_wakeup(struct task *t, unsigned int f)
 {
-	SPIN_LOCK(TASK_RQ_LOCK, &rq_lock);
+	HA_SPIN_LOCK(TASK_RQ_LOCK, &rq_lock);
 
 	/* If task is running, we postpone the call
 	 * and backup the state.
 	 */
 	if (unlikely(t->state & TASK_RUNNING)) {
 		t->pending_state |= f;
-		SPIN_UNLOCK(TASK_RQ_LOCK, &rq_lock);
+		HA_SPIN_UNLOCK(TASK_RQ_LOCK, &rq_lock);
 		return t;
 	}
 	if (likely(!task_in_rq(t)))
 		__task_wakeup(t);
 	t->state |= f;
-	SPIN_UNLOCK(TASK_RQ_LOCK, &rq_lock);
+	HA_SPIN_UNLOCK(TASK_RQ_LOCK, &rq_lock);
 
 	return t;
 }
@@ -148,10 +148,10 @@
 
 static inline struct task *task_unlink_wq(struct task *t)
 {
-	SPIN_LOCK(TASK_WQ_LOCK, &wq_lock);
+	HA_SPIN_LOCK(TASK_WQ_LOCK, &wq_lock);
 	if (likely(task_in_wq(t)))
 		__task_unlink_wq(t);
-	SPIN_UNLOCK(TASK_WQ_LOCK, &wq_lock);
+	HA_SPIN_UNLOCK(TASK_WQ_LOCK, &wq_lock);
 	return t;
 }
 
@@ -176,10 +176,10 @@
  */
 static inline struct task *task_unlink_rq(struct task *t)
 {
-	SPIN_LOCK(TASK_RQ_LOCK, &rq_lock);
+	HA_SPIN_LOCK(TASK_RQ_LOCK, &rq_lock);
 	if (likely(task_in_rq(t)))
 		__task_unlink_rq(t);
-	SPIN_UNLOCK(TASK_RQ_LOCK, &rq_lock);
+	HA_SPIN_UNLOCK(TASK_RQ_LOCK, &rq_lock);
 	return t;
 }
 
@@ -256,10 +256,10 @@
 	if (!tick_isset(task->expire))
 		return;
 
-	SPIN_LOCK(TASK_WQ_LOCK, &wq_lock);
+	HA_SPIN_LOCK(TASK_WQ_LOCK, &wq_lock);
 	if (!task_in_wq(task) || tick_is_lt(task->expire, task->wq.key))
 		__task_queue(task);
-	SPIN_UNLOCK(TASK_WQ_LOCK, &wq_lock);
+	HA_SPIN_UNLOCK(TASK_WQ_LOCK, &wq_lock);
 }
 
 /* Ensure <task> will be woken up at most at <when>. If the task is already in
@@ -272,14 +272,14 @@
 	if (task_in_rq(task))
 		return;
 
-	SPIN_LOCK(TASK_WQ_LOCK, &wq_lock);
+	HA_SPIN_LOCK(TASK_WQ_LOCK, &wq_lock);
 	if (task_in_wq(task))
 		when = tick_first(when, task->expire);
 
 	task->expire = when;
 	if (!task_in_wq(task) || tick_is_lt(task->expire, task->wq.key))
 		__task_queue(task);
-	SPIN_UNLOCK(TASK_WQ_LOCK, &wq_lock);
+	HA_SPIN_UNLOCK(TASK_WQ_LOCK, &wq_lock);
 }
 
 /* This function register a new signal. "lua" is the current lua
@@ -296,7 +296,7 @@
 		return NULL;
 	LIST_ADDQ(purge, &com->purge_me);
 	LIST_ADDQ(event, &com->wake_me);
-	SPIN_INIT(&com->lock);
+	HA_SPIN_INIT(&com->lock);
 	com->task = wakeup;
 	return com;
 }
@@ -311,15 +311,15 @@
 
 	/* Delete all pending communication signals. */
 	list_for_each_entry_safe(com, back, purge, purge_me) {
-		SPIN_LOCK(NOTIF_LOCK, &com->lock);
+		HA_SPIN_LOCK(NOTIF_LOCK, &com->lock);
 		LIST_DEL(&com->purge_me);
 		if (!com->task) {
-			SPIN_UNLOCK(NOTIF_LOCK, &com->lock);
+			HA_SPIN_UNLOCK(NOTIF_LOCK, &com->lock);
 			pool_free2(pool2_notification, com);
 			continue;
 		}
 		com->task = NULL;
-		SPIN_UNLOCK(NOTIF_LOCK, &com->lock);
+		HA_SPIN_UNLOCK(NOTIF_LOCK, &com->lock);
 	}
 }
 
@@ -333,16 +333,16 @@
 
 	/* Wake task and delete all pending communication signals. */
 	list_for_each_entry_safe(com, back, wake, wake_me) {
-		SPIN_LOCK(NOTIF_LOCK, &com->lock);
+		HA_SPIN_LOCK(NOTIF_LOCK, &com->lock);
 		LIST_DEL(&com->wake_me);
 		if (!com->task) {
-			SPIN_UNLOCK(NOTIF_LOCK, &com->lock);
+			HA_SPIN_UNLOCK(NOTIF_LOCK, &com->lock);
 			pool_free2(pool2_notification, com);
 			continue;
 		}
 		task_wakeup(com->task, TASK_WOKEN_MSG);
 		com->task = NULL;
-		SPIN_UNLOCK(NOTIF_LOCK, &com->lock);
+		HA_SPIN_UNLOCK(NOTIF_LOCK, &com->lock);
 	}
 }