MINOR: tinfo: add the mask of enabled threads in each group
In order to replace the global "all_threads_mask" we'll need to have an
equivalent per group. Take this opportunity for calling it threads_enabled
and make sure which ones are counted there (in case in the future we allow
to stop some).
diff --git a/include/haproxy/tinfo-t.h b/include/haproxy/tinfo-t.h
index 5f0d794..f7a7494 100644
--- a/include/haproxy/tinfo-t.h
+++ b/include/haproxy/tinfo-t.h
@@ -52,6 +52,7 @@
* at 1 so tgroup[0] describes thread group 1.
*/
struct tgroup_info {
+ ulong threads_enabled; /* mask of threads enabled in this group */
uint base; /* first thread in this group */
uint count; /* number of threads in this group */
ulong tgid_bit; /* bit corresponding to the tgroup ID */
diff --git a/src/haproxy.c b/src/haproxy.c
index 1df98d6..79d40ab 100644
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -2973,6 +2973,7 @@
ptff->fct();
#ifdef USE_THREAD
+ _HA_ATOMIC_AND(&ha_tgroup_info[ti->tgid].threads_enabled, ~ti->ltid_bit);
_HA_ATOMIC_AND(&all_threads_mask, ~tid_bit);
if (tid > 0)
pthread_exit(NULL);
diff --git a/src/thread.c b/src/thread.c
index dedde13..d895bbc 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -1082,6 +1082,11 @@
ha_thread_info[t].ltid_bit = 1UL << ha_thread_info[t].ltid;
}
+ for (g = 0; g < global.nbtgroups; g++) {
+ ha_tgroup_info[g].threads_enabled = nbits(ha_tgroup_info[g].count);
+
+ }
+
return 0;
}