diff options
author | Ulrich Drepper <drepper@redhat.com> | 2004-03-07 10:40:53 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2004-03-07 10:40:53 +0000 |
commit | 4d1a02efc1117763c67fe012642381e3106500cf (patch) | |
tree | 3e1416ebaf41ca04937a91e3b9e6ba72b057c752 /nptl | |
parent | ead327594300796f6e87293c5a53827b744eb93d (diff) | |
download | glibc-4d1a02efc1117763c67fe012642381e3106500cf.zip glibc-4d1a02efc1117763c67fe012642381e3106500cf.tar.gz glibc-4d1a02efc1117763c67fe012642381e3106500cf.tar.bz2 |
Update.
2004-03-07 Ulrich Drepper <drepper@redhat.com>
* tst-once4.c: Remove unnecessary macro definition.
* tst-mutex7.c (do_test): Limit thread stack size.
* tst-once2.c (do_test): Likewise.
* tst-tls3.c (do_test): Likewise.
* tst-tls1.c (do_test): Likewise.
* tst-signal3.c (do_test): Likewise.
* tst-kill6.c (do_test): Likewise.
* tst-key4.c (do_test): Likewise.
* tst-join4.c (do_test): Likewise.
* tst-fork1.c (do_test): Likewise.
* tst-context1.c (do_test): Likewise.
* tst-cond2.c (do_test): Likewise.
* tst-cond10.c (do_test): Likewise.
* tst-clock2.c (do_test): Likewise.
* tst-cancel10.c (do_test): Likewise.
* tst-basic2.c (do_test): Likewise.
* tst-barrier4.c (do_test): Likewise.
Diffstat (limited to 'nptl')
-rw-r--r-- | nptl/ChangeLog | 21 | ||||
-rw-r--r-- | nptl/tst-barrier4.c | 21 | ||||
-rw-r--r-- | nptl/tst-basic2.c | 24 | ||||
-rw-r--r-- | nptl/tst-cancel10.c | 24 | ||||
-rw-r--r-- | nptl/tst-clock2.c | 24 | ||||
-rw-r--r-- | nptl/tst-cond10.c | 24 | ||||
-rw-r--r-- | nptl/tst-cond2.c | 24 | ||||
-rw-r--r-- | nptl/tst-context1.c | 24 | ||||
-rw-r--r-- | nptl/tst-fork1.c | 21 | ||||
-rw-r--r-- | nptl/tst-join4.c | 20 | ||||
-rw-r--r-- | nptl/tst-key4.c | 22 | ||||
-rw-r--r-- | nptl/tst-kill6.c | 24 | ||||
-rw-r--r-- | nptl/tst-mutex7.c | 23 | ||||
-rw-r--r-- | nptl/tst-once2.c | 23 | ||||
-rw-r--r-- | nptl/tst-signal3.c | 24 | ||||
-rw-r--r-- | nptl/tst-tls1.c | 24 | ||||
-rw-r--r-- | nptl/tst-tls2.c | 24 | ||||
-rw-r--r-- | nptl/tst-tls3.c | 24 |
18 files changed, 379 insertions, 36 deletions
diff --git a/nptl/ChangeLog b/nptl/ChangeLog index dcb26a5..6d271a0 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,3 +1,24 @@ +2004-03-07 Ulrich Drepper <drepper@redhat.com> + + * tst-once4.c: Remove unnecessary macro definition. + + * tst-mutex7.c (do_test): Limit thread stack size. + * tst-once2.c (do_test): Likewise. + * tst-tls3.c (do_test): Likewise. + * tst-tls1.c (do_test): Likewise. + * tst-signal3.c (do_test): Likewise. + * tst-kill6.c (do_test): Likewise. + * tst-key4.c (do_test): Likewise. + * tst-join4.c (do_test): Likewise. + * tst-fork1.c (do_test): Likewise. + * tst-context1.c (do_test): Likewise. + * tst-cond2.c (do_test): Likewise. + * tst-cond10.c (do_test): Likewise. + * tst-clock2.c (do_test): Likewise. + * tst-cancel10.c (do_test): Likewise. + * tst-basic2.c (do_test): Likewise. + * tst-barrier4.c (do_test): Likewise. + 2004-03-05 Ulrich Drepper <drepper@redhat.com> * sysdeps/i386/tls.h: Use GLRO instead of GL where appropriate. diff --git a/nptl/tst-barrier4.c b/nptl/tst-barrier4.c index a811fee..56ea044 100644 --- a/nptl/tst-barrier4.c +++ b/nptl/tst-barrier4.c @@ -64,8 +64,21 @@ tf (void *arg) static int do_test (void) { + pthread_attr_t at; int cnt; + if (pthread_attr_init (&at) != 0) + { + puts ("attr_init failed"); + return 1; + } + + if (pthread_attr_setstacksize (&at, 1 * 1024 * 1024) != 0) + { + puts ("attr_setstacksize failed"); + return 1; + } + if (pthread_barrier_init (&b1, NULL, N) != 0) { puts ("1st barrier_init failed"); @@ -80,12 +93,18 @@ do_test (void) pthread_t th[N - 1]; for (cnt = 0; cnt < N - 1; ++cnt) - if (pthread_create (&th[cnt], NULL, tf, NULL) != 0) + if (pthread_create (&th[cnt], &at, tf, NULL) != 0) { puts ("pthread_create failed"); return 1; } + if (pthread_attr_destroy (&at) != 0) + { + puts ("attr_destroy failed"); + return 1; + } + tf (NULL); for (cnt = 0; cnt < N - 1; ++cnt) diff --git a/nptl/tst-basic2.c b/nptl/tst-basic2.c index b9478c0..1c4632c 100644 --- a/nptl/tst-basic2.c +++ b/nptl/tst-basic2.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. @@ -49,6 +49,20 @@ do_test (void) exit (1); } + pthread_attr_t at; + + if (pthread_attr_init (&at) != 0) + { + puts ("attr_init failed"); + return 1; + } + + if (pthread_attr_setstacksize (&at, 1 * 1024 * 1024) != 0) + { + puts ("attr_setstacksize failed"); + return 1; + } + int i; for (i = 0; i < N; ++i) { @@ -64,7 +78,7 @@ do_test (void) exit (1); } - if (pthread_create (&th[i], NULL, tf, (void *) (long int) i) != 0) + if (pthread_create (&th[i], &at, tf, (void *) (long int) i) != 0) { puts ("create failed"); exit (1); @@ -79,6 +93,12 @@ do_test (void) printf ("created thread %d\n", i); } + if (pthread_attr_destroy (&at) != 0) + { + puts ("attr_destroy failed"); + return 1; + } + int result = 0; for (i = 0; i < N; ++i) { diff --git a/nptl/tst-cancel10.c b/nptl/tst-cancel10.c index b8b9953..7af0f2f 100644 --- a/nptl/tst-cancel10.c +++ b/nptl/tst-cancel10.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 Ulrich Drepper <drepper@redhat.com>, 2003. @@ -71,17 +71,37 @@ tf (void *arg) static int do_test (void) { + pthread_attr_t at; + + if (pthread_attr_init (&at) != 0) + { + puts ("attr_init failed"); + return 1; + } + + if (pthread_attr_setstacksize (&at, 1 * 1024 * 1024) != 0) + { + puts ("attr_setstacksize failed"); + return 1; + } + #define N 20 int i; pthread_t th[N]; for (i = 0; i < N; ++i) - if (pthread_create (&th[i], NULL, tf, (void *) (long int) i) != 0) + if (pthread_create (&th[i], &at, tf, (void *) (long int) i) != 0) { puts ("create failed"); exit (1); } + if (pthread_attr_destroy (&at) != 0) + { + puts ("attr_destroy failed"); + return 1; + } + for (i = 0; i < N; ++i) { void *r; diff --git a/nptl/tst-clock2.c b/nptl/tst-clock2.c index 4c716b0..62e5752 100644 --- a/nptl/tst-clock2.c +++ b/nptl/tst-clock2.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 Ulrich Drepper <drepper@redhat.com>, 2003. @@ -78,11 +78,25 @@ do_test (void) cl[0] = CLOCK_THREAD_CPUTIME_ID; #endif + pthread_attr_t at; + + if (pthread_attr_init (&at) != 0) + { + puts ("attr_init failed"); + return 1; + } + + if (pthread_attr_setstacksize (&at, 1 * 1024 * 1024) != 0) + { + puts ("attr_setstacksize failed"); + return 1; + } + int i; int e; for (i = 0; i < N; ++i) { - if (pthread_create (&th[i], NULL, tf, NULL) != 0) + if (pthread_create (&th[i], &at, tf, NULL) != 0) { puts ("create failed"); return 1; @@ -106,6 +120,12 @@ do_test (void) } } + if (pthread_attr_destroy (&at) != 0) + { + puts ("attr_destroy failed"); + return 1; + } + struct timespec t[N + 1]; for (i = 0; i < N + 1; ++i) if (clock_gettime (cl[i], &t[i]) != 0) diff --git a/nptl/tst-cond10.c b/nptl/tst-cond10.c index 5bf5d1f..34956d4 100644 --- a/nptl/tst-cond10.c +++ b/nptl/tst-cond10.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 Ulrich Drepper <drepper@redhat.com>, 2003. @@ -87,6 +87,20 @@ do_test (void) exit (1); } + pthread_attr_t at; + + if (pthread_attr_init (&at) != 0) + { + puts ("attr_init failed"); + return 1; + } + + if (pthread_attr_setstacksize (&at, 1 * 1024 * 1024) != 0) + { + puts ("attr_setstacksize failed"); + return 1; + } + int r; for (r = 0; r < ROUNDS; ++r) { @@ -96,7 +110,7 @@ do_test (void) pthread_t th[N]; for (i = 0; i < N; ++i) { - if (pthread_create (&th[i], NULL, tf, NULL) != 0) + if (pthread_create (&th[i], &at, tf, NULL) != 0) { puts ("create failed"); exit (1); @@ -145,6 +159,12 @@ do_test (void) } } + if (pthread_attr_destroy (&at) != 0) + { + puts ("attr_destroy failed"); + return 1; + } + return 0; } diff --git a/nptl/tst-cond2.c b/nptl/tst-cond2.c index 21bf817..36f0f29 100644 --- a/nptl/tst-cond2.c +++ b/nptl/tst-cond2.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. @@ -86,11 +86,25 @@ do_test (void) exit (1); } + pthread_attr_t at; + + if (pthread_attr_init (&at) != 0) + { + puts ("attr_init failed"); + return 1; + } + + if (pthread_attr_setstacksize (&at, 1 * 1024 * 1024) != 0) + { + puts ("attr_setstacksize failed"); + return 1; + } + for (i = 0; i < N; ++i) { printf ("create thread %d\n", i); - err = pthread_create (&th[i], NULL, tf, (void *) (long int) i); + err = pthread_create (&th[i], &at, tf, (void *) (long int) i); if (err != 0) error (EXIT_FAILURE, err, "cannot create thread %d", i); @@ -106,6 +120,12 @@ do_test (void) } } + if (pthread_attr_destroy (&at) != 0) + { + puts ("attr_destroy failed"); + return 1; + } + puts ("get lock outselves"); err = pthread_mutex_lock (&mut); diff --git a/nptl/tst-context1.c b/nptl/tst-context1.c index 0edee00..ff6e381 100644 --- a/nptl/tst-context1.c +++ b/nptl/tst-context1.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 Ulrich Drepper <drepper@redhat.com>, 2003. @@ -111,13 +111,33 @@ do_test (void) } puts ("global OK"); + pthread_attr_t at; + + if (pthread_attr_init (&at) != 0) + { + puts ("attr_init failed"); + return 1; + } + + if (pthread_attr_setstacksize (&at, 1 * 1024 * 1024) != 0) + { + puts ("attr_setstacksize failed"); + return 1; + } + for (n = 0; n < N; ++n) - if (pthread_create (&th[n], NULL, tf, (void *) (long int) n) != 0) + if (pthread_create (&th[n], &at, tf, (void *) (long int) n) != 0) { puts ("create failed"); exit (1); } + if (pthread_attr_destroy (&at) != 0) + { + puts ("attr_destroy failed"); + return 1; + } + for (n = 0; n < N; ++n) if (pthread_join (th[n], NULL) != 0) { diff --git a/nptl/tst-fork1.c b/nptl/tst-fork1.c index 56ffe50..33c4ed8 100644 --- a/nptl/tst-fork1.c +++ b/nptl/tst-fork1.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Roland McGrath <roland@redhat.com>, 2002. @@ -71,6 +71,19 @@ main (void) pthread_t th[N]; int i; int result = 0; + pthread_attr_t at; + + if (pthread_attr_init (&at) != 0) + { + puts ("attr_init failed"); + return 1; + } + + if (pthread_attr_setstacksize (&at, 1 * 1024 * 1024) != 0) + { + puts ("attr_setstacksize failed"); + return 1; + } for (i = 0; i < N; ++i) if (pthread_create (&th[i], NULL, thread_function, @@ -80,6 +93,12 @@ main (void) exit (1); } + if (pthread_attr_destroy (&at) != 0) + { + puts ("attr_destroy failed"); + return 1; + } + for (i = 0; i < N; ++i) { void *v; diff --git a/nptl/tst-join4.c b/nptl/tst-join4.c index 0b60590..b13a510 100644 --- a/nptl/tst-join4.c +++ b/nptl/tst-join4.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 Ulrich Drepper <drepper@redhat.com>, 2003. @@ -48,19 +48,25 @@ do_test (void) exit (1); } - pthread_t th[2]; + pthread_attr_t a; - if (pthread_create (&th[0], NULL, tf, NULL) != 0) + if (pthread_attr_init (&a) != 0) { - puts ("1st create failed"); + puts ("attr_init failed"); exit (1); } - pthread_attr_t a; + if (pthread_attr_setstacksize (&a, 1 * 1024 * 1024) != 0) + { + puts ("attr_setstacksize failed"); + return 1; + } - if (pthread_attr_init (&a) != 0) + pthread_t th[2]; + + if (pthread_create (&th[0], &a, tf, NULL) != 0) { - puts ("attr_init failed"); + puts ("1st create failed"); exit (1); } diff --git a/nptl/tst-key4.c b/nptl/tst-key4.c index 7e9bfdd..0a5b448 100644 --- a/nptl/tst-key4.c +++ b/nptl/tst-key4.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 Ulrich Drepper <drepper@redhat.com>, 2003. @@ -75,6 +75,20 @@ do_test (void) exit (1); } + pthread_attr_t a; + + if (pthread_attr_init (&a) != 0) + { + puts ("attr_init failed"); + exit (1); + } + + if (pthread_attr_setstacksize (&a, 1 * 1024 * 1024) != 0) + { + puts ("attr_setstacksize failed"); + return 1; + } + for (i = 0; i < 10; ++i) { int j; @@ -109,6 +123,12 @@ do_test (void) } } + if (pthread_attr_destroy (&a) != 0) + { + puts ("attr_destroy failed"); + exit (1); + } + return 0; } diff --git a/nptl/tst-kill6.c b/nptl/tst-kill6.c index 9956dcb..26e82d9 100644 --- a/nptl/tst-kill6.c +++ b/nptl/tst-kill6.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 Ulrich Drepper <drepper@redhat.com>, 2003. @@ -88,15 +88,35 @@ do_test (void) exit (1); } + pthread_attr_t a; + + if (pthread_attr_init (&a) != 0) + { + puts ("attr_init failed"); + exit (1); + } + + if (pthread_attr_setstacksize (&a, 1 * 1024 * 1024) != 0) + { + puts ("attr_setstacksize failed"); + return 1; + } + pthread_t th[N]; int i; for (i = 0; i < N; ++i) - if (pthread_create (&th[i], NULL, tf, NULL) != 0) + if (pthread_create (&th[i], &a, tf, NULL) != 0) { puts ("create failed"); exit (1); } + if (pthread_attr_destroy (&a) != 0) + { + puts ("attr_destroy failed"); + exit (1); + } + if (sem_init (&sem, 0, 0) != 0) { puts ("sem_init failed"); diff --git a/nptl/tst-mutex7.c b/nptl/tst-mutex7.c index 9ee8ece..183fd10 100644 --- a/nptl/tst-mutex7.c +++ b/nptl/tst-mutex7.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. @@ -60,9 +60,22 @@ tf (void *arg) static int do_test (void) { + pthread_attr_t at; pthread_t th[N]; int cnt; + if (pthread_attr_init (&at) != 0) + { + puts ("attr_init failed"); + return 1; + } + + if (pthread_attr_setstacksize (&at, 1 * 1024 * 1024) != 0) + { + puts ("attr_setstacksize failed"); + return 1; + } + if (pthread_mutex_lock (&lock) != 0) { puts ("locking in parent failed"); @@ -70,12 +83,18 @@ do_test (void) } for (cnt = 0; cnt < N; ++cnt) - if (pthread_create (&th[cnt], NULL, tf, (void *) (long int) cnt) != 0) + if (pthread_create (&th[cnt], &at, tf, (void *) (long int) cnt) != 0) { printf ("creating thread %d failed\n", cnt); return 1; } + if (pthread_attr_destroy (&at) != 0) + { + puts ("attr_destroy failed"); + return 1; + } + if (pthread_mutex_unlock (&lock) != 0) { puts ("unlocking in parent failed"); diff --git a/nptl/tst-once2.c b/nptl/tst-once2.c index 3fbc4a9..c606345 100644 --- a/nptl/tst-once2.c +++ b/nptl/tst-once2.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. @@ -60,16 +60,35 @@ tf (void *arg) static int do_test (void) { + pthread_attr_t at; pthread_t th[N]; int cnt; + if (pthread_attr_init (&at) != 0) + { + puts ("attr_init failed"); + return 1; + } + + if (pthread_attr_setstacksize (&at, 1 * 1024 * 1024) != 0) + { + puts ("attr_setstacksize failed"); + return 1; + } + for (cnt = 0; cnt < N; ++cnt) - if (pthread_create (&th[cnt], NULL, tf, (void *) (long int) cnt) != 0) + if (pthread_create (&th[cnt], &at, tf, (void *) (long int) cnt) != 0) { printf ("creation of thread %d failed\n", cnt); return 1; } + if (pthread_attr_destroy (&at) != 0) + { + puts ("attr_destroy failed"); + return 1; + } + for (cnt = 0; cnt < N; ++cnt) if (pthread_join (th[cnt], NULL) != 0) { diff --git a/nptl/tst-signal3.c b/nptl/tst-signal3.c index ef9ca9c..e4756c5 100644 --- a/nptl/tst-signal3.c +++ b/nptl/tst-signal3.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. @@ -132,6 +132,20 @@ do_test (void) exit (1); } + pthread_attr_t a; + + if (pthread_attr_init (&a) != 0) + { + puts ("attr_init failed"); + exit (1); + } + + if (pthread_attr_setstacksize (&a, 1 * 1024 * 1024) != 0) + { + puts ("attr_setstacksize failed"); + return 1; + } + for (i = 0; i < N; ++i) { if (pthread_mutex_init (&lock[i], NULL) != 0) @@ -144,13 +158,19 @@ do_test (void) printf ("mutex_lock[%d] failed\n", i); } - if (pthread_create (&th[i], NULL, tf, (void *) (long int) i) != 0) + if (pthread_create (&th[i], &a, tf, (void *) (long int) i) != 0) { printf ("create of thread %d failed\n", i); exit (1); } } + if (pthread_attr_destroy (&a) != 0) + { + puts ("attr_destroy failed"); + exit (1); + } + int result = 0; unsigned int r = 42; pid_t pid = getpid (); diff --git a/nptl/tst-tls1.c b/nptl/tst-tls1.c index 3668162..4e19122 100644 --- a/nptl/tst-tls1.c +++ b/nptl/tst-tls1.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 Ulrich Drepper <drepper@redhat.com>, 2003. @@ -71,6 +71,20 @@ do_test (void) exit (1); } + pthread_attr_t a; + + if (pthread_attr_init (&a) != 0) + { + puts ("attr_init failed"); + exit (1); + } + + if (pthread_attr_setstacksize (&a, 1 * 1024 * 1024) != 0) + { + puts ("attr_setstacksize failed"); + return 1; + } + #define N 10 int i; for (i = 0; i < N; ++i) @@ -79,7 +93,7 @@ do_test (void) pthread_t th[M]; int j; for (j = 0; j < M; ++j, ++s.a) - if (pthread_create (&th[j], NULL, tf, NULL) != 0) + if (pthread_create (&th[j], &a, tf, NULL) != 0) { puts ("pthread_create failed"); exit (1); @@ -93,6 +107,12 @@ do_test (void) } } + if (pthread_attr_destroy (&a) != 0) + { + puts ("attr_destroy failed"); + exit (1); + } + return 0; #endif } diff --git a/nptl/tst-tls2.c b/nptl/tst-tls2.c index 1d8ea14..73ed33e 100644 --- a/nptl/tst-tls2.c +++ b/nptl/tst-tls2.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 Ulrich Drepper <drepper@redhat.com>, 2003. @@ -140,14 +140,34 @@ do_test (void) exit (1); } + pthread_attr_t a; + + if (pthread_attr_init (&a) != 0) + { + puts ("attr_init failed"); + exit (1); + } + + if (pthread_attr_setstacksize (&a, 1 * 1024 * 1024) != 0) + { + puts ("attr_setstacksize failed"); + return 1; + } + int i; for (i = 0; i < N; ++i) - if (pthread_create (&th[i], NULL, tf, cbs[i]) != 0) + if (pthread_create (&th[i], &a, tf, cbs[i]) != 0) { puts ("pthread_create failed"); exit (1); } + if (pthread_attr_destroy (&a) != 0) + { + puts ("attr_destroy failed"); + exit (1); + } + pthread_barrier_wait (&b); sigset_t ss; diff --git a/nptl/tst-tls3.c b/nptl/tst-tls3.c index 20ee3e3..8c2663b 100644 --- a/nptl/tst-tls3.c +++ b/nptl/tst-tls3.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 Ulrich Drepper <drepper@redhat.com>, 2003. @@ -127,12 +127,26 @@ do_test (void) exit (1); } + pthread_attr_t a; + + if (pthread_attr_init (&a) != 0) + { + puts ("attr_init failed"); + exit (1); + } + + if (pthread_attr_setstacksize (&a, 1 * 1024 * 1024) != 0) + { + puts ("attr_setstacksize failed"); + return 1; + } + int r; for (r = 0; r < 10; ++r) { int i; for (i = 0; i < N; ++i) - if (pthread_create (&th[i], NULL, tf, cbs[i]) != 0) + if (pthread_create (&th[i], &a, tf, cbs[i]) != 0) { puts ("pthread_create failed"); exit (1); @@ -185,6 +199,12 @@ do_test (void) } } + if (pthread_attr_destroy (&a) != 0) + { + puts ("attr_destroy failed"); + exit (1); + } + return 0; #endif } |