diff --git a/include/haproxy/tinfo-t.h b/include/haproxy/tinfo-t.h index ba2424975..dde3fe9b8 100644 --- a/include/haproxy/tinfo-t.h +++ b/include/haproxy/tinfo-t.h @@ -60,6 +60,8 @@ struct tgroup_info { */ struct thread_info { const struct tgroup_info *tg; /* config of the thread-group this thread belongs to */ + uint tid, ltid; /* process-wide and group-wide thread ID (start at 0) */ + ulong tid_bit, ltid_bit; /* bit masks for the tid/ltid */ /* pad to cache line (64B) */ char __pad[0]; /* unused except to check remaining room */ diff --git a/src/thread.c b/src/thread.c index 0b979f912..2f904deae 100644 --- a/src/thread.c +++ b/src/thread.c @@ -1075,6 +1075,14 @@ int thread_map_to_groups() return -1; } + for (t = 0; t < global.nbthread; t++) { + ha_thread_info[t].tid = t; + ha_thread_info[t].ltid = t - ha_thread_info[t].tg->base; + + ha_thread_info[t].tid_bit = 1UL << ha_thread_info[t].tid; + ha_thread_info[t].ltid_bit = 1UL << ha_thread_info[t].ltid; + } + return 0; }