diff options
author | Sergey Bugaev <bugaevc@gmail.com> | 2021-09-15 20:11:08 +0300 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2021-09-16 01:04:05 +0200 |
commit | 166bb3eac351b88191d440b0fe8d5d7b757eaed0 (patch) | |
tree | 2a0366c36387bcee5c4ae2704ccca394cd969f48 /htl/pt-internal.h | |
parent | 4b6574a6f63b6c766f27be4a0b4c9376a35a4bd5 (diff) | |
download | glibc-166bb3eac351b88191d440b0fe8d5d7b757eaed0.zip glibc-166bb3eac351b88191d440b0fe8d5d7b757eaed0.tar.gz glibc-166bb3eac351b88191d440b0fe8d5d7b757eaed0.tar.bz2 |
htl: Move thread table to ld.so
The next commit is going to introduce a new implementation of
THREAD_GSCOPE_WAIT which needs to access the list of threads.
Since it must be usable from the dynamic laoder, we have to move
the symbols for the list of threads into the loader.
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <20210915171110.226187-2-bugaevc@gmail.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Diffstat (limited to 'htl/pt-internal.h')
-rw-r--r-- | htl/pt-internal.h | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/htl/pt-internal.h b/htl/pt-internal.h index 34e6da3..b17f12b 100644 --- a/htl/pt-internal.h +++ b/htl/pt-internal.h @@ -166,33 +166,24 @@ __pthread_dequeue (struct __pthread *thread) /* The total number of threads currently active. */ extern unsigned int __pthread_total; -/* The total number of thread IDs currently in use, or on the list of - available thread IDs. */ -extern int __pthread_num_threads; - /* Concurrency hint. */ extern int __pthread_concurrency; -/* Array of __pthread structures and its lock. Indexed by the pthread - id minus one. (Why not just use the pthread id? Because some - brain-dead users of the pthread interface incorrectly assume that 0 - is an invalid pthread id.) */ -extern struct __pthread **__pthread_threads; +/* The size of the thread ID lookup table. */ extern int __pthread_max_threads; -extern pthread_rwlock_t __pthread_threads_lock; #define __pthread_getid(thread) \ ({ struct __pthread *__t = NULL; \ - __pthread_rwlock_rdlock (&__pthread_threads_lock); \ + __libc_rwlock_rdlock (GL (dl_pthread_threads_lock)); \ if (thread <= __pthread_max_threads) \ - __t = __pthread_threads[thread - 1]; \ - __pthread_rwlock_unlock (&__pthread_threads_lock); \ + __t = GL (dl_pthread_threads)[thread - 1]; \ + __libc_rwlock_unlock (GL (dl_pthread_threads_lock)); \ __t; }) #define __pthread_setid(thread, pthread) \ - __pthread_rwlock_wrlock (&__pthread_threads_lock); \ - __pthread_threads[thread - 1] = pthread; \ - __pthread_rwlock_unlock (&__pthread_threads_lock); + __libc_rwlock_wrlock (GL (dl_pthread_threads_lock)); \ + GL (dl_pthread_threads)[thread - 1] = pthread; \ + __libc_rwlock_unlock (GL (dl_pthread_threads_lock)); /* Similar to pthread_self, but returns the thread descriptor instead of the thread ID. */ |