1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +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

@ -44,6 +44,9 @@ static td_thr_events_t __nptl_threads_events;
/* Pointer to descriptor with the last event. */
static struct pthread *__nptl_last_event;
/* Number of threads running. */
unsigned int __nptl_nthreads = 1;
/* Code to allocate and deallocate a stack. */
#define DEFINE_DEALLOC
@ -197,6 +200,9 @@ __free_tcb (struct pthread *pd)
static int
start_thread (void *arg)
{
/* One more thread. */
atomic_increment (&__nptl_nthreads);
struct pthread *pd = (struct pthread *) arg;
#if HP_TIMING_AVAIL
@ -215,6 +221,14 @@ start_thread (void *arg)
}
/* If this is the last thread we terminate the process now. We
do not notify the debugger, it might just irritate it if there
is no thread left. */
if (atomic_decrement_and_test (&__nptl_nthreads))
/* This was the last thread. */
exit (0);
/* Report the death of the thread if this is wanted. */
if (__builtin_expect (pd->report_events, 0))
{