Optimize for kernels which are known to have the vfork syscall.
[glibc/pb-stable.git] / linuxthreads / joinrace.c
blob8e1064c984ef7bf4876e601429efd52d9f73b751
1 /* Test case by Permaine Cheung <pcheung@cygnus.com>. */
3 #include <errno.h>
4 #include <pthread.h>
5 #include <stdio.h>
6 #include <stdlib.h>
8 static void *
9 sub1 (void *arg)
11 /* Nothing. */
12 return NULL;
15 int
16 main (void)
18 int istatus;
19 int policy;
20 int cnt;
21 pthread_t thread1;
22 struct sched_param spresult1, sp1;
24 for (cnt = 0; cnt < 100; ++cnt)
26 printf ("Round %d\n", cnt);
28 pthread_create (&thread1, NULL, &sub1, NULL);
29 pthread_join (thread1, NULL);
31 istatus = pthread_getschedparam (thread1, &policy, &spresult1);
32 if (istatus != ESRCH)
34 printf ("pthread_getschedparam returns: %d\n", istatus);
35 return 1;
38 sp1.sched_priority = 0;
39 istatus = pthread_setschedparam (thread1, SCHED_OTHER, &sp1);
40 if (istatus != ESRCH)
42 printf ("pthread_setschedparam returns: %d\n", istatus);
43 return 2;
47 return 0;