diff options
author | Sergey Bugaev <bugaevc@gmail.com> | 2024-03-23 20:32:59 +0300 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2024-03-23 23:00:30 +0100 |
commit | dc1a77269c971652a8a5167ec366792eae052e65 (patch) | |
tree | 5da3b6767ba21b2405404f9c9228a7af5b67decb /sysdeps/htl | |
parent | a4273efa219480a7f2c9c8fa7bc8bb71c48c3604 (diff) | |
download | glibc-dc1a77269c971652a8a5167ec366792eae052e65.tar.gz glibc-dc1a77269c971652a8a5167ec366792eae052e65.tar.xz glibc-dc1a77269c971652a8a5167ec366792eae052e65.zip |
htl: Implement some support for TLS_DTV_AT_TP
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-ID: <20240323173301.151066-19-bugaevc@gmail.com>
Diffstat (limited to 'sysdeps/htl')
-rw-r--r-- | sysdeps/htl/dl-thread_gscope_wait.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/sysdeps/htl/dl-thread_gscope_wait.c b/sysdeps/htl/dl-thread_gscope_wait.c index 90a9a79850..ee0a316527 100644 --- a/sysdeps/htl/dl-thread_gscope_wait.c +++ b/sysdeps/htl/dl-thread_gscope_wait.c @@ -20,6 +20,18 @@ #include <pthread.h> #include <htl/pt-internal.h> +static inline int * +thread_gscope_flag (struct __pthread *t) +{ +#if TLS_TCB_AT_TP + return &t->tcb->gscope_flag; +#elif TLS_DTV_AT_TP + return &((tcbprehead_t *) t->tcb - 1)->gscope_flag; +#else +# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined" +#endif +} + void __thread_gscope_wait (void) { @@ -33,10 +45,10 @@ __thread_gscope_wait (void) for (i = 0; i < GL (dl_pthread_num_threads); ++i) { t = GL (dl_pthread_threads[i]); - if (t == NULL || t->tcb->gscope_flag == THREAD_GSCOPE_FLAG_UNUSED) + if (t == NULL || *thread_gscope_flag (t) == THREAD_GSCOPE_FLAG_UNUSED) continue; - gscope_flagp = &t->tcb->gscope_flag; + gscope_flagp = thread_gscope_flag (t); /* We have to wait until this thread is done with the global scope. First tell the thread that we are waiting and |