]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
REORG: threads: move the struct thread_info from global.h to hathreads.h
authorWilly Tarreau <w@1wt.eu>
Mon, 20 May 2019 16:56:48 +0000 (18:56 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 20 May 2019 18:00:25 +0000 (20:00 +0200)
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.

include/common/hathreads.h
include/types/global.h
src/hathreads.c

index 2be5915c0825a059c1ae98cb663d393ce73c548a..0dbec671d7a8f8b9640460df84f8f5f597a40304 100644 (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;
index 030a553e28a8ba812c704d5e5eede05ed7a7a3a1..a52b258b0f3d3178599c1037c6d824b7cc332699 100644 (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 */
index fc17318672bd56a0e7c894e99cc29149568d8461..2dbf467e81b75f408e6a21eb745df8c1411cebbb 100644 (file)
@@ -29,6 +29,7 @@
 #include <types/global.h>
 #include <proto/fd.h>
 
+struct thread_info thread_info[MAX_THREADS];
 
 #ifdef USE_THREAD