]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - nptl/tst-cleanup1.c
Add per-thread cache to malloc
[thirdparty/glibc.git] / nptl / tst-cleanup1.c
index a6b61425a64e103b4440fc751af527aae90a2f06..7aaf995fe694e1f53d001c6fb88a14d305530557 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2017 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -13,9 +13,8 @@
    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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
 
 #include <pthread.h>
 #include <stdio.h>
 #include <unistd.h>
 
 
+static int do_test (void);
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
+
 static int global;
 
 
@@ -41,7 +45,7 @@ ch (void *arg)
 static void *
 tf (void *a)
 {
-  pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
+  pthread_cancel (pthread_self ());
 
   pthread_cleanup_push (ch, (void *) 1l);
 
@@ -49,7 +53,7 @@ tf (void *a)
 
   pthread_cleanup_push (ch, (void *) 3l);
 
-  pthread_cancel (pthread_self ());
+  pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
 
   pthread_cleanup_pop (1);
 
@@ -68,7 +72,7 @@ do_test (void)
 
   if (pthread_create (&th, NULL, tf, NULL) != 0)
     {
-      write (2, "create failed\n", 14);
+      write_message ("create failed\n");
       _exit (1);
     }
 
@@ -94,7 +98,3 @@ do_test (void)
 
   return 0;
 }
-
-
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"