MINOR: threads: set the group ID and its bit in the thread group
authorWilly Tarreau <w@1wt.eu>
Tue, 28 Sep 2021 06:50:02 +0000 (08:50 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 8 Oct 2021 15:22:26 +0000 (17:22 +0200)
This will ease the reporting of the current thread group ID when coming
from the thread itself, especially since it returns the visible ID,
starting at 1.

include/haproxy/tinfo-t.h
src/thread.c

index e2779ab..ba24249 100644 (file)
@@ -46,6 +46,7 @@ enum {
 struct tgroup_info {
        uint base;                 /* first thread in this group */
        uint count;                /* number of threads in this group */
+       uint tgid;                 /* group ID (starts at 1, 0=unspecified) */
 
        /* pad to cache line (64B) */
        char __pad[0];            /* unused except to check remaining room */
index 2a7d3af..0b979f9 100644 (file)
@@ -1019,6 +1019,7 @@ int thread_map_to_groups()
        for (g = 0; g < global.nbtgroups; g++) {
                if (!ha_tgroup_info[g].count)
                        ug++;
+               ha_tgroup_info[g].tgid = g + 1;
        }
 
        if (ug > ut) {