diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-08-08 12:10:06 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-08-08 12:17:48 +0200 |
commit | 644aa127b9b42a899a12b6ccc6644bc035c231e3 (patch) | |
tree | 46590a3c1c485dc2f423ded55671f4cb56bed532 /sysdeps/htl/pt-getspecific.c | |
parent | dcad5c8578130dec7f35fd5b0885304b59f9f543 (diff) | |
download | glibc-644aa127b9b42a899a12b6ccc6644bc035c231e3.tar.gz glibc-644aa127b9b42a899a12b6ccc6644bc035c231e3.tar.xz glibc-644aa127b9b42a899a12b6ccc6644bc035c231e3.zip |
htl: Add support for static TSD data
When using jemalloc, malloc() needs to use TSD, while libpthread initialization needs malloc(). Supporting a static TSD area allows jemalloc and libpthread to initialize together.
Diffstat (limited to 'sysdeps/htl/pt-getspecific.c')
-rw-r--r-- | sysdeps/htl/pt-getspecific.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sysdeps/htl/pt-getspecific.c b/sysdeps/htl/pt-getspecific.c index 68a2503563..4d42cba93d 100644 --- a/sysdeps/htl/pt-getspecific.c +++ b/sysdeps/htl/pt-getspecific.c @@ -29,6 +29,14 @@ __pthread_getspecific (pthread_key_t key) return NULL; self = _pthread_self (); + + if (self->thread_specifics == NULL) + { + if (key >= PTHREAD_STATIC_KEYS) + return NULL; + return self->static_thread_specifics[key]; + } + if (key >= self->thread_specifics_size) return 0; |