1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00
* sysdeps/generic/dl-tls.c (allocate_dtv): Optimize a bit.
This commit is contained in:
Ulrich Drepper
2002-08-20 08:12:32 +00:00
parent 9a1eb38e4e
commit 58d2d09bde
5 changed files with 18 additions and 10 deletions

View File

@ -1,5 +1,7 @@
2002-08-20 Ulrich Drepper <drepper@redhat.com> 2002-08-20 Ulrich Drepper <drepper@redhat.com>
* sysdeps/generic/dl-tls.c (allocate_dtv): Optimize a bit.
* elf/Versions [ld] (GLIBC_PRIVATE): Add _dl_get_tls_static_info. * elf/Versions [ld] (GLIBC_PRIVATE): Add _dl_get_tls_static_info.
* sysdeps/generic/dl-tls.c (_dl_allocate_tls_storage): Move dtv * sysdeps/generic/dl-tls.c (_dl_allocate_tls_storage): Move dtv
memory allocation to... memory allocation to...

View File

@ -1,3 +1,10 @@
2002-08-20 Ulrich Drepper <drepper@redhat.com>
* manager.c (pthread_handle_create): Pass NULL to _dl_allocate_tls.
Pass true to _dl_deallocate_tls.
(pthread_free): Likewise.
* pthread.c (__pthread_initialize_manager): Likewise.
2002-08-19 Ulrich Drepper <drepper@redhat.com> 2002-08-19 Ulrich Drepper <drepper@redhat.com>
* sysdeps/i386/useldt.h (DO_SET_THREAD_AREA): Use correct shift when * sysdeps/i386/useldt.h (DO_SET_THREAD_AREA): Use correct shift when

View File

@ -599,7 +599,7 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr,
int saved_errno = 0; int saved_errno = 0;
#ifdef USE_TLS #ifdef USE_TLS
new_thread = _dl_allocate_tls (); new_thread = _dl_allocate_tls (NULL);
if (new_thread == NULL) if (new_thread == NULL)
return EAGAIN; return EAGAIN;
#else #else
@ -619,7 +619,7 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr,
if (sseg >= PTHREAD_THREADS_MAX) if (sseg >= PTHREAD_THREADS_MAX)
{ {
#ifdef USE_TLS #ifdef USE_TLS
_dl_deallocate_tls (new_thread); _dl_deallocate_tls (new_thread, true);
#endif #endif
return EAGAIN; return EAGAIN;
} }
@ -803,7 +803,7 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr,
#endif #endif
} }
#ifdef USE_TLS #ifdef USE_TLS
_dl_deallocate_tls (new_thread); _dl_deallocate_tls (new_thread, true);
#endif #endif
__pthread_handles[sseg].h_descr = NULL; __pthread_handles[sseg].h_descr = NULL;
__pthread_handles[sseg].h_bottom = NULL; __pthread_handles[sseg].h_bottom = NULL;
@ -890,7 +890,7 @@ static void pthread_free(pthread_descr th)
munmap(guardaddr, stacksize + guardsize); munmap(guardaddr, stacksize + guardsize);
#ifdef USE_TLS #ifdef USE_TLS
_dl_deallocate_tls (th); _dl_deallocate_tls (th, true);
#endif #endif
} }
} }

View File

@ -623,7 +623,8 @@ int __pthread_initialize_manager(void)
#ifdef USE_TLS #ifdef USE_TLS
/* Allocate memory for the thread descriptor and the dtv. */ /* Allocate memory for the thread descriptor and the dtv. */
__pthread_handles[1].h_descr = manager_thread = tcb = _dl_allocate_tls (); __pthread_handles[1].h_descr = manager_thread = tcb
= _dl_allocate_tls (NULL);
if (tcb == NULL) { if (tcb == NULL) {
free(__pthread_manager_thread_bos); free(__pthread_manager_thread_bos);
__libc_close(manager_pipe[0]); __libc_close(manager_pipe[0]);

View File

@ -212,11 +212,9 @@ allocate_dtv (void *result)
{ {
/* This is the initial length of the dtv. */ /* This is the initial length of the dtv. */
dtv[0].counter = dtv_length; dtv[0].counter = dtv_length;
/* Fill in the generation number. */ /* Initialize all of the rest of the dtv (including the
dtv[1].counter = GL(dl_tls_generation) = 0; generation counter) with zero to indicate nothing there. */
/* Initialize all of the rest of the dtv with zero to indicate memset (dtv + 1, '\0', (dtv_length + 1) * sizeof (dtv_t));
nothing there. */
memset (dtv + 2, '\0', dtv_length * sizeof (dtv_t));
/* Add the dtv to the thread data structures. */ /* Add the dtv to the thread data structures. */
INSTALL_DTV (result, dtv); INSTALL_DTV (result, dtv);