yuezonghe | 824eb0c | 2024-06-27 02:32:26 -0700 | [diff] [blame] | 1 | #include <sysdep.h> |
| 2 | #include <tls.h> |
| 3 | |
| 4 | -- This line separates the #include lines from conditionals. |
| 5 | |
| 6 | # ifdef USE_TLS |
| 7 | |
| 8 | -- Abuse tls.h macros to derive offsets relative to the thread register. |
| 9 | # undef __thread_register |
| 10 | # define __thread_register ((void *) 0) |
| 11 | # define thread_offsetof(mem) ((ptrdiff_t) THREAD_SELF + offsetof (struct _pthread_descr_struct, p_##mem)) |
| 12 | |
| 13 | # else |
| 14 | |
| 15 | # define thread_offsetof(mem) offsetof (tcbhead_t, mem) |
| 16 | |
| 17 | # endif |
| 18 | |
| 19 | MULTIPLE_THREADS_OFFSET thread_offsetof (multiple_threads) |