From 2d7ae2107d3713981a66011ec62d094e32ec46fb Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 4 May 2004 19:25:38 +0000 Subject: Update. * sysdeps/unix/sysv/linux/ia64/Makefile (librt-routines): Mention rt-sysdep. * sysdeps/unix/sysv/linux/ia64/rt-sysdep.S: New file. --- linuxthreads/tst-stack1.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) (limited to 'linuxthreads/tst-stack1.c') diff --git a/linuxthreads/tst-stack1.c b/linuxthreads/tst-stack1.c index fa9aeddd9c..057bfa3f9f 100644 --- a/linuxthreads/tst-stack1.c +++ b/linuxthreads/tst-stack1.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2003 Free Software Foundation, Inc. +/* Copyright (C) 2003, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek , 2003. @@ -17,11 +17,9 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -/* Test whether pthread_create/pthread_join with user defined stacks - doesn't leak memory. */ +/* Test pthread_create/pthread_join with user defined stacks. */ #include -#include #include #include #include @@ -37,13 +35,13 @@ tf (void *p) return NULL; } +#define N 16 + static int do_test (void) { - mtrace (); - void *stack; - int res = posix_memalign (&stack, getpagesize (), 4 * PTHREAD_STACK_MIN); + int res = posix_memalign (&stack, getpagesize (), N * 4 * PTHREAD_STACK_MIN); if (res) { printf ("malloc failed %s\n", strerror (res)); @@ -54,15 +52,17 @@ do_test (void) pthread_attr_init (&attr); int result = 0; - res = pthread_attr_setstack (&attr, stack, 4 * PTHREAD_STACK_MIN); - if (res) + for (int i = 0; i < N; ++i) { - printf ("pthread_attr_setstack failed %d\n", res); - result = 1; - } + res = pthread_attr_setstack (&attr, stack + i * 4 * PTHREAD_STACK_MIN, + 4 * PTHREAD_STACK_MIN); + if (res) + { + printf ("pthread_attr_setstack failed %d\n", res); + result = 1; + continue; + } - for (int i = 0; i < 16; ++i) - { /* Create the thread. */ pthread_t th; res = pthread_create (&th, &attr, tf, NULL); @@ -84,13 +84,12 @@ do_test (void) pthread_attr_destroy (&attr); - if (seen != 16) + if (seen != N) { - printf ("seen %d != 16\n", seen); + printf ("seen %d != %d\n", seen, N); result = 1; } - free (stack); return result; } -- cgit 1.4.1