1 #include <pthread.h>
2
3 extern void print (char *);
4
5 #define PRINT_LOOP 10
6
7 void *
th_main(void * arg)8 th_main (void *arg)
9 {
10 int i;
11 for (i=0; i<PRINT_LOOP; i++)
12 print (arg);
13 }
14
15 int
main()16 main ()
17 {
18 pthread_t thread1;
19 pthread_t thread2;
20 pthread_t thread3;
21 pthread_create (&thread1, NULL, th_main, "aaa");
22 pthread_create (&thread2, NULL, th_main, "bbb");
23 pthread_create (&thread3, NULL, th_main, "ccc");
24 pthread_join (thread1, NULL);
25 pthread_join (thread2, NULL);
26 pthread_join (thread3, NULL);
27 return 0;
28 }
29
30