REORG: threads: move the struct thread_info from global.h to hathreads.h

It doesn't make sense to keep this struct thread_info in global.h, it
causes difficulties to access its contents from hathreads.h, let's move
it to the threads where it ought to have been created.
This commit is contained in:
Willy Tarreau 2019-05-20 18:56:48 +02:00
parent e3e2b7283f
commit 5a6e2245fa
3 changed files with 15 additions and 5 deletions

View File

@ -49,6 +49,12 @@ enum { all_threads_mask = 1UL };
enum { tid_bit = 1UL };
enum { tid = 0 };
extern struct thread_info {
/* pad to cache line (64B) */
char __pad[0]; /* unused except to check remaining room */
char __end[0] __attribute__((aligned(64)));
} thread_info[MAX_THREADS];
#define __decl_hathreads(decl)
#define __decl_spinlock(lock)
#define __decl_aligned_spinlock(lock)
@ -369,6 +375,14 @@ void thread_harmless_till_end();
void thread_isolate();
void thread_release();
extern struct thread_info {
pthread_t pthread;
clockid_t clock_id;
/* pad to cache line (64B) */
char __pad[0]; /* unused except to check remaining room */
char __end[0] __attribute__((aligned(64)));
} thread_info[MAX_THREADS];
extern THREAD_LOCAL unsigned int tid; /* The thread id */
extern THREAD_LOCAL unsigned long tid_bit; /* The bit corresponding to the thread id */
extern volatile unsigned long all_threads_mask;

View File

@ -243,11 +243,6 @@ extern unsigned int rlim_fd_cur_at_boot;
extern unsigned int rlim_fd_max_at_boot;
extern int atexit_flag;
extern struct thread_info {
__decl_hathreads(pthread_t pthread);
__decl_hathreads(clockid_t clock_id);
} thread_info[MAX_THREADS];
/* bit values to go with "warned" above */
#define WARN_BLOCK_DEPRECATED 0x00000001
/* unassigned : 0x00000002 */

View File

@ -29,6 +29,7 @@
#include <types/global.h>
#include <proto/fd.h>
struct thread_info thread_info[MAX_THREADS];
#ifdef USE_THREAD