1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-28 00:21:52 +03:00
2003-02-14  Ulrich Drepper  <drepper@redhat.com>

	* sysdeps/generic/libc-start.c [HAVE_PTR_NTHREADS]: Decrement thread
	counter and only call __exit_thread if this is not the last thread.
This commit is contained in:
Ulrich Drepper
2003-02-14 23:31:11 +00:00
parent e320ef46a7
commit 472022708e
11 changed files with 157 additions and 24 deletions

View File

@ -74,9 +74,6 @@ static LIST_HEAD (stack_used);
list_t __stack_user __attribute__ ((nocommon));
hidden_def (__stack_user)
/* Number of threads running. */
static unsigned int nptl_nthreads = 1;
/* Number of threads created. */
static unsigned int nptl_ncreated;
@ -142,9 +139,6 @@ get_cached_stack (size_t *sizep, void **memp)
/* And add to the list of stacks in use. */
list_add (&result->header.data.list, &stack_used);
/* One more thread. */
++nptl_nthreads;
/* And decrease the cache size. */
stack_cache_actsize -= result->stackblock_size;
@ -299,9 +293,6 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
/* And add to the list of stacks in use. */
list_add (&pd->header.data.list, &__stack_user);
/* One more thread. */
++nptl_nthreads;
lll_unlock (stack_cache_lock);
}
else
@ -416,9 +407,6 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
/* And add to the list of stacks in use. */
list_add (&pd->header.data.list, &stack_used);
/* One more thread. */
++nptl_nthreads;
lll_unlock (stack_cache_lock);
@ -444,9 +432,6 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
/* Remove the thread from the list. */
list_del (&pd->header.data.list);
/* The thread is gone. */
--nptl_nthreads;
lll_unlock (stack_cache_lock);
/* Free the memory regardless of whether the size of the
@ -510,9 +495,6 @@ __deallocate_stack (struct pthread *pd)
/* Free the memory associated with the ELF TLS. */
_dl_deallocate_tls (pd, false);
/* One less thread. */
--nptl_nthreads;
lll_unlock (stack_cache_lock);
}
@ -563,7 +545,7 @@ __reclaim_stacks (void)
list_add (&self->header.data.list, &stack_used);
/* There is one thread running. */
nptl_nthreads = 1;
__nptl_nthreads = 1;
/* Initialize the lock. */
stack_cache_lock = LLL_LOCK_INITIALIZER;