(res_isourserver): Fix cast.
[glibc/pb-stable.git] / linuxthreads / Examples / ex6.c
blobf8ce0662c229d9321bf9d3fd08cf6038c267ef74
1 #include <errno.h>
2 #include <stdio.h>
3 #include <string.h>
4 #include <pthread.h>
5 #include <unistd.h>
7 static void *
8 test_thread (void *v_param)
10 return NULL;
13 int
14 main (void)
16 unsigned long count;
18 setvbuf (stdout, NULL, _IONBF, 0);
20 for (count = 0; count < 2000; ++count)
22 pthread_t thread;
23 int status;
25 status = pthread_create (&thread, NULL, test_thread, NULL);
26 if (status != 0)
28 printf ("status = %d, count = %lu: %s\n", status, count,
29 strerror (errno));
30 return 1;
32 else
34 printf ("count = %lu\n", count);
36 /* pthread_detach (thread); */
37 if (pthread_join (thread, NULL) != 0)
39 printf ("join failed, count %lu\n", count);
40 return 2;
42 usleep (10);
44 return 0;