[PATCH] for ex9 test case failure

Steven Munroe sjmunroe@vnet.ibm.com
Wed Jun 19 16:40:00 GMT 2002


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;
    }
  



More information about the Libc-alpha mailing list