mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-24 07:11:20 +02:00
The thread group info is not sufficient to represent a thread group's current state as it's read-only. We also need something comparable to the thread context to represent the aggregate state of the threads in that group. This patch introduces ha_tgroup_ctx[] and tg_ctx for this. It's indexed on the group id and must be cache-line aligned. The thread masks that were global and that do not need to remain global were moved there (want_rdv, harmless, idle). Given that all the masks placed there now become group-specific, the associated thread mask (tid_bit) now switches to the thread's local bit (ltid_bit). Both are the same for nbtgroups 1 but will differ for other values. There's also a tg_ctx pointer in the thread so that it can be reached from other threads.
42 lines
1.5 KiB
C
42 lines
1.5 KiB
C
/*
|
|
* include/haproxy/tinfo.h
|
|
* Export of ha_thread_info[] and ti pointer.
|
|
*
|
|
* Copyright (C) 2020 Willy Tarreau - w@1wt.eu
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation, version 2.1
|
|
* exclusively.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
*/
|
|
|
|
#ifndef _HAPROXY_TINFO_H
|
|
#define _HAPROXY_TINFO_H
|
|
|
|
#include <haproxy/api.h>
|
|
#include <haproxy/tinfo-t.h>
|
|
|
|
/* the structs are in thread.c */
|
|
extern struct tgroup_info ha_tgroup_info[MAX_TGROUPS];
|
|
extern THREAD_LOCAL const struct tgroup_info *tg;
|
|
|
|
extern struct thread_info ha_thread_info[MAX_THREADS];
|
|
extern THREAD_LOCAL const struct thread_info *ti; /* thread_info for the current thread */
|
|
|
|
extern struct tgroup_ctx ha_tgroup_ctx[MAX_TGROUPS];
|
|
extern THREAD_LOCAL struct tgroup_ctx *tg_ctx; /* ha_tgroup_ctx for the current thread */
|
|
|
|
extern struct thread_ctx ha_thread_ctx[MAX_THREADS];
|
|
extern THREAD_LOCAL struct thread_ctx *th_ctx; /* ha_thread_ctx for the current thread */
|
|
|
|
#endif /* _HAPROXY_TINFO_H */
|