about summary refs log tree commit diff
path: root/nptl/tst-pthread_exit-nothreads.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2021-04-21 19:49:50 +0200
committerFlorian Weimer <fweimer@redhat.com>2021-04-21 19:49:50 +0200
commitc62cef023cdcd8349369ef4e0d08290e495659be (patch)
tree5039f207754a42ced241ef75d77c6c3da689f7da /nptl/tst-pthread_exit-nothreads.c
parent2cfef0b042561ec2a61cab0a1f3a85a28780985d (diff)
downloadglibc-c62cef023cdcd8349369ef4e0d08290e495659be.tar.gz
glibc-c62cef023cdcd8349369ef4e0d08290e495659be.tar.xz
glibc-c62cef023cdcd8349369ef4e0d08290e495659be.zip
nptl: Move pthread_exit into libc
The pthread_exit symbol was moved using
scripts/move-symbol-to-libc.py.  No new symbol version is needed
because there was a forwarder.

The new tests nptl/tst-pthread_exit-nothreads and
nptl/tst-pthread_exit-nothreads-static exercise the scenario
that pthread_exit is called without libpthread having been linked in.
This is not possible for the generic code, so these tests do not
live in sysdeps/pthread for now.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Diffstat (limited to 'nptl/tst-pthread_exit-nothreads.c')
-rw-r--r--nptl/tst-pthread_exit-nothreads.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/nptl/tst-pthread_exit-nothreads.c b/nptl/tst-pthread_exit-nothreads.c
new file mode 100644
index 0000000000..d47455c75c
--- /dev/null
+++ b/nptl/tst-pthread_exit-nothreads.c
@@ -0,0 +1,28 @@
+/* Check that pthread_exit works if there are no threads.
+   Copyright (C) 2021 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <pthread.h>
+
+static int
+do_test (void)
+{
+  pthread_exit (NULL);
+  return 1;                     /* Not reached.  */
+}
+
+#include <support/test-driver.c>