about summary refs log tree commit diff
path: root/nptl/allocatestack.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2009-01-29 20:38:04 +0000
committerUlrich Drepper <drepper@redhat.com>2009-01-29 20:38:04 +0000
commitcca50323b6a80283886c5fb6e2cff25f6c2d006b (patch)
tree3787ee6c3122d8692610861baba3db91b997e8d8 /nptl/allocatestack.c
parentcdf77dd87b27260d1aefbad18aaa169d4a3a6121 (diff)
downloadglibc-cca50323b6a80283886c5fb6e2cff25f6c2d006b.tar.gz
glibc-cca50323b6a80283886c5fb6e2cff25f6c2d006b.tar.xz
glibc-cca50323b6a80283886c5fb6e2cff25f6c2d006b.zip
* allocatestack.c (__free_stacks): Renamed from free_stacks.
	(__free_stack_cache): Removed.  Change callers to call __free_stacks.
	* init.c (nptl_freeres): New function.
	(pthread_functions): Initialize ptr_freeres to nptl_freeres.
	* pthreadP.h: Don't declare __free_stack_cache.  Declare __free_stacks.
	* sysdeps/pthread/unwind-forcedunwind.c (libgcc_s_handle): New
	variable.
	(pthread_cancel_init): Depend in libgcc_s_handle for decision to
	load DSO.  Assign last.
	(__unwind_freeres): New function.

	* allocatestack.c (__reclaim_stacks): Reset in_flight_stack later
	for better debugging.  No need to use stack_list_add here.
Diffstat (limited to 'nptl/allocatestack.c')
-rw-r--r--nptl/allocatestack.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c
index ce05770e56..67ea0c68f8 100644
--- a/nptl/allocatestack.c
+++ b/nptl/allocatestack.c
@@ -248,8 +248,8 @@ get_cached_stack (size_t *sizep, void **memp)
 
 
 /* Free stacks until cache size is lower than LIMIT.  */
-static void
-free_stacks (size_t limit)
+void
+__free_stacks (size_t limit)
 {
   /* We reduce the size of the cache.  Remove the last entries until
      the size is below the limit.  */
@@ -299,15 +299,7 @@ queue_stack (struct pthread *stack)
 
   stack_cache_actsize += stack->stackblock_size;
   if (__builtin_expect (stack_cache_actsize > stack_cache_maxsize, 0))
-    free_stacks (stack_cache_maxsize);
-}
-
-
-/* This function is called indirectly from the freeres code in libc.  */
-void
-__free_stack_cache (void)
-{
-  free_stacks (0);
+    __free_stacks (stack_cache_maxsize);
 }
 
 
@@ -849,8 +841,6 @@ __reclaim_stacks (void)
 	  elem->next->prev = elem->prev;
 	  elem->prev->next = elem->next;
 	}
-
-      in_flight_stack = 0;
     }
 
   /* Mark all stacks except the still running one as free.  */
@@ -913,11 +903,13 @@ __reclaim_stacks (void)
   if (__builtin_expect (THREAD_GETMEM (self, user_stack), 0))
     list_add (&self->list, &__stack_user);
   else
-    stack_list_add (&self->list, &stack_used);
+    list_add (&self->list, &stack_used);
 
   /* There is one thread running.  */
   __nptl_nthreads = 1;
 
+  in_flight_stack = 0;
+
   /* Initialize the lock.  */
   stack_cache_lock = LLL_LOCK_INITIALIZER;
 }