STYLE: Nightly Version update
[cmake.git] / Modules / CheckForPthreads.c
blob2f0c203b55f66198e7f10a360c3f7a844506bf4a
1 #include <stdio.h>
2 #include <pthread.h>
3 #include <unistd.h>
5 void* runner(void*);
7 int res = 0;
8 #ifdef __CLASSIC_C__
9 int main(){
10 int ac;
11 char*av[];
12 #else
13 int main(int ac, char*av[]){
14 #endif
15 pthread_t tid[2];
16 pthread_create(&tid[0], 0, runner, (void*)1);
17 pthread_create(&tid[1], 0, runner, (void*)2);
19 usleep(1); // for strange behavior on single-processor sun
20 pthread_join(tid[0], 0);
21 pthread_join(tid[1], 0);
22 if(ac > 1000){return *av[0];}
23 return res;
26 void* runner(void* args)
28 int cc;
29 for ( cc = 0; cc < 10; cc ++ )
31 printf("%d CC: %d\n", (int)args, cc);
33 res ++;
34 return 0;