/* Only way found to replace variables with constants that are optimized away
* at build time.
*/
-enum { all_threads_mask = 1UL };
enum { all_tgroups_mask = 1UL };
enum { tid_bit = 1UL };
enum { tid = 0 };
void set_thread_cpu_affinity();
unsigned long long ha_get_pthread_id(unsigned int thr);
-extern volatile unsigned long all_threads_mask;
extern volatile unsigned long all_tgroups_mask;
extern volatile unsigned int rdv_requests;
extern volatile unsigned int isolated_thread;
-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) */
tg = thr->tg;
tid = thr->tid;
tgid = thr->tgid;
- tid_bit = 1UL << tid; /* FIXME: must become thr->ltid_bit */
th_ctx = &ha_thread_ctx[tid];
tg_ctx = &ha_tgroup_ctx[tgid-1];
} else {
tgid = 1;
tid = 0;
- tid_bit = 1;
ti = &ha_thread_info[0];
tg = &ha_tgroup_info[0];
th_ctx = &ha_thread_ctx[0];
global.nbthread = numa_cores ? numa_cores :
thread_cpus_enabled_at_boot;
}
- all_threads_mask = nbits(global.nbthread);
#endif
}
global.nbthread = 1;
-#ifdef USE_THREAD
- tid_bit = 1;
- all_threads_mask = 1;
-#endif
-
jobs++; /* this is the "master" job, we want to take care of the
signals even if there is no listener so the poll loop don't
leave */
_HA_ATOMIC_AND(&all_tgroups_mask, ~tg->tgid_bit);
if (!_HA_ATOMIC_AND_FETCH(&tg_ctx->stopping_threads, ~ti->ltid_bit))
_HA_ATOMIC_AND(&stopping_tgroup_mask, ~tg->tgid_bit);
- _HA_ATOMIC_AND(&all_threads_mask, ~tid_bit);
if (tid > 0)
pthread_exit(NULL);
#endif
#ifdef USE_THREAD
-volatile unsigned long all_threads_mask __read_mostly = 1; // nbthread 1 assumed by default
volatile unsigned long all_tgroups_mask __read_mostly = 1; // nbtgroup 1 assumed by default
volatile unsigned int rdv_requests = 0; // total number of threads requesting RDV
volatile unsigned int isolated_thread = ~0; // ID of the isolated thread, or ~0 when none
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;
static pthread_t ha_pthread[MAX_THREADS] = { };
memprintf(err, "'%s' value must be between 1 and %d (was %ld)", args[0], MAX_THREADS, nbthread);
return -1;
}
-
- all_threads_mask = nbits(nbthread);
#endif
HA_DIAG_WARNING_COND(global.nbthread,