MEDIUM: task/debug: move the ->thread_mask integrity checks to ->tid

Let's make sure the new ->tid field is always correct instead of checking
the thread mask.
diff --git a/include/haproxy/applet.h b/include/haproxy/applet.h
index 84619de..68f98e2 100644
--- a/include/haproxy/applet.h
+++ b/include/haproxy/applet.h
@@ -70,7 +70,7 @@
 	 * the appctx will be fully initialized. The session and the stream will
 	 * eventually be created. The affinity must be set now !
 	 */
-	BUG_ON((appctx->t->thread_mask & tid_bit) == 0);
+	BUG_ON(appctx->t->tid != tid);
 	task_set_affinity(appctx->t, tid_bit);
 
 	if (appctx->applet->init)
diff --git a/include/haproxy/task.h b/include/haproxy/task.h
index d5458bf..2d86452 100644
--- a/include/haproxy/task.h
+++ b/include/haproxy/task.h
@@ -279,7 +279,7 @@
 
 	if (likely(task_in_wq(t))) {
 		locked = t->state & TASK_SHARED_WQ;
-		BUG_ON(!locked && t->thread_mask != tid_bit);
+		BUG_ON(!locked && t->tid != tid);
 		if (locked)
 			HA_RWLOCK_WRLOCK(TASK_WQ_LOCK, &wq_lock);
 		__task_unlink_wq(t);
@@ -318,7 +318,7 @@
 	} else
 #endif
 	{
-		BUG_ON(task->thread_mask != tid_bit); // should have TASK_SHARED_WQ
+		BUG_ON(task->tid != tid); // should have TASK_SHARED_WQ
 		if (!task_in_wq(task) || tick_is_lt(task->expire, task->wq.key))
 			__task_queue(task, &th_ctx->timers);
 	}
@@ -731,7 +731,7 @@
 	} else
 #endif
 	{
-		BUG_ON((task->thread_mask & tid_bit) == 0); // should have TASK_SHARED_WQ
+		BUG_ON(task->tid != tid);
 		if (task_in_wq(task))
 			when = tick_first(when, task->expire);