about summary refs log tree commit diff
path: root/nptl/pthread_create.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2021-05-11 11:08:00 +0200
committerFlorian Weimer <fweimer@redhat.com>2021-05-11 11:24:36 +0200
commit8fbb33b3f74560ea3c74d289bdf59cffce52b463 (patch)
treece89a60001d8a815ac5aba3fe6511b03609302b3 /nptl/pthread_create.c
parentc79a31fb36fe265f7566bea622849b06c94b4022 (diff)
downloadglibc-8fbb33b3f74560ea3c74d289bdf59cffce52b463.tar.gz
glibc-8fbb33b3f74560ea3c74d289bdf59cffce52b463.tar.xz
glibc-8fbb33b3f74560ea3c74d289bdf59cffce52b463.zip
nptl: Move __free_tcb into libc
Under the name __nptl_free_tcb.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Diffstat (limited to 'nptl/pthread_create.c')
-rw-r--r--nptl/pthread_create.c27
1 files changed, 1 insertions, 26 deletions
diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
index fcaf440bb5..770656453d 100644
--- a/nptl/pthread_create.c
+++ b/nptl/pthread_create.c
@@ -207,31 +207,6 @@ static int create_thread (struct pthread *pd, const struct pthread_attr *attr,
 
 #include <createthread.c>
 
-/* Deallocate a thread's stack after optionally making sure the thread
-   descriptor is still valid.  */
-void
-__free_tcb (struct pthread *pd)
-{
-  /* The thread is exiting now.  */
-  if (__builtin_expect (atomic_bit_test_set (&pd->cancelhandling,
-					     TERMINATED_BIT) == 0, 1))
-    {
-      /* Free TPP data.  */
-      if (__glibc_unlikely (pd->tpp != NULL))
-	{
-	  struct priority_protection_data *tpp = pd->tpp;
-
-	  pd->tpp = NULL;
-	  free (tpp);
-	}
-
-      /* Queue the stack memory block for reuse and exit the process.  The
-	 kernel will signal via writing to the address returned by
-	 QUEUE-STACK when the stack is available.  */
-      __nptl_deallocate_stack (pd);
-    }
-}
-
 /* Local function to start thread and handle cleanup.
    createthread.c defines the macro START_THREAD_DEFN to the
    declaration that its create_thread function will refer to, and
@@ -444,7 +419,7 @@ START_THREAD_DEFN
   /* If the thread is detached free the TCB.  */
   if (IS_DETACHED (pd))
     /* Free the TCB.  */
-    __free_tcb (pd);
+    __nptl_free_tcb (pd);
 
   /* We cannot call '_exit' here.  '_exit' will terminate the process.