mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 14:21:25 +02:00
MINOR: threads: add the current group ID in thread-local "tgid" variable
This is the equivalent of "tid" for ease of access. In the future if we make th_cfg a pure thread-local array (not a pointer), it may make sense to move it there.
This commit is contained in:
parent
43ab05b3da
commit
b90935c908
@ -61,6 +61,7 @@ enum { threads_sync_mask = 0 };
|
||||
enum { threads_want_rdv_mask = 0 };
|
||||
enum { tid_bit = 1UL };
|
||||
enum { tid = 0 };
|
||||
enum { tgid = 1 };
|
||||
|
||||
#define HA_SPIN_INIT(l) do { /* do nothing */ } while(0)
|
||||
#define HA_SPIN_DESTROY(l) do { /* do nothing */ } while(0)
|
||||
@ -184,6 +185,7 @@ extern volatile unsigned long threads_sync_mask;
|
||||
extern volatile unsigned long threads_want_rdv_mask;
|
||||
extern THREAD_LOCAL unsigned long tid_bit; /* The bit corresponding to the thread id */
|
||||
extern THREAD_LOCAL unsigned int tid; /* The thread id */
|
||||
extern THREAD_LOCAL unsigned int tgid; /* The thread group id (starts at 1) */
|
||||
|
||||
/* explanation for threads_want_rdv_mask, threads_harmless_mask, and
|
||||
* threads_sync_mask :
|
||||
@ -222,13 +224,16 @@ static inline void ha_set_thread(const struct thread_info *thr)
|
||||
if (thr) {
|
||||
BUG_ON(!thr->tid_bit);
|
||||
BUG_ON(!thr->tg);
|
||||
BUG_ON(!thr->tg->tgid);
|
||||
|
||||
ti = thr;
|
||||
tg = thr->tg;
|
||||
tid = thr->tid;
|
||||
tid_bit = thr->tid_bit;
|
||||
th_ctx = &ha_thread_ctx[tid];
|
||||
tgid = tg->tgid;
|
||||
} else {
|
||||
tgid = 1;
|
||||
tid = 0;
|
||||
tid_bit = 1;
|
||||
ti = &ha_thread_info[0];
|
||||
|
@ -66,6 +66,7 @@ volatile unsigned long threads_harmless_mask = 0;
|
||||
volatile unsigned long threads_idle_mask = 0;
|
||||
volatile unsigned long threads_sync_mask = 0;
|
||||
volatile unsigned long all_threads_mask __read_mostly = 1; // nbthread 1 assumed by default
|
||||
THREAD_LOCAL unsigned int tgid = 1; // thread ID starts at 1
|
||||
THREAD_LOCAL unsigned int tid = 0;
|
||||
THREAD_LOCAL unsigned long tid_bit = (1UL << 0);
|
||||
int thread_cpus_enabled_at_boot = 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user