This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
[PATCH] for ex9 test case failure
- From: Steven Munroe <sjmunroe at vnet dot ibm dot com>
- To: libc-alpha at sources dot redhat dot com
- Date: Wed, 19 Jun 2002 16:21:47 -0500
- Subject: [PATCH] for ex9 test case failure
Cleaned up patch per Andreas Jaeger.
* Examples/ex9.c (main): Use list of children and join them.
(thread): Do not call exit.
*** glibc-2.2.5/linuxthreads/Examples/ex9.c Tue Jun 20 23:32:01 2000
--- libc225/linuxthreads/Examples/ex9.c Tue Jun 18 16:42:33 2002
*************** int
*** 33,37 ****
main (void)
{
! pthread_t th;
int i;
--- 33,38 ----
main (void)
{
! pthread_t th;
! pthread_t thread_list[NUM_THREADS];
int i;
*************** main (void)
*** 41,50 ****
for (i = 0; i < NUM_THREADS; i++)
{
! if (pthread_create (&th, NULL, thread, NULL) != 0)
error (EXIT_FAILURE, 0, "cannot create thread");
}
(void) thread (NULL);
! /* notreached */
return 0;
}
--- 42,56 ----
for (i = 0; i < NUM_THREADS; i++)
{
! if (pthread_create (&thread_list[i], NULL, thread, NULL) != 0)
error (EXIT_FAILURE, 0, "cannot create thread");
}
(void) thread (NULL);
!
! for (i = 0; i < NUM_THREADS; i++)
! {
! pthread_join(thread_list[i], NULL);
! }
!
return 0;
}
*************** thread (void *arg)
*** 88,92 ****
++linecount, (unsigned long) self);
funlockfile (stdout);
! exit (0);
}
--- 94,98 ----
++linecount, (unsigned long) self);
funlockfile (stdout);
! return;
}