1
/* Creates two threads, one printing 10000 "a"s, the other printing
3
Illustrates: thread creation, thread joining. */
14
fprintf (stderr, "Starting process %s\n", (char *) arg);
15
for (i = 0; i < 10000; i++)
17
write (1, (char *) arg, 1);
29
retcode = pthread_create (&th_a, NULL, process, (void *) "a");
31
fprintf (stderr, "create a failed %d\n", retcode);
32
retcode = pthread_create (&th_b, NULL, process, (void *) "b");
34
fprintf (stderr, "create b failed %d\n", retcode);
35
retcode = pthread_join (th_a, &retval);
37
fprintf (stderr, "join a failed %d\n", retcode);
38
retcode = pthread_join (th_b, &retval);
40
fprintf (stderr, "join b failed %d\n", retcode);