Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Modules / CheckForPthreads.c
blobd831078510221e2cd7d1b8b373ff0355318ba19a
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 #if defined(__BEOS__) && !defined(__ZETA__) && !defined(__HAIKU__) // (no usleep on BeOS 5.)
20 usleep(1); // for strange behavior on single-processor sun
21 #endif
23 pthread_join(tid[0], 0);
24 pthread_join(tid[1], 0);
25 if(ac > 1000){return *av[0];}
26 return res;
29 void* runner(void* args)
31 int cc;
32 for ( cc = 0; cc < 10; cc ++ )
34 printf("%d CC: %d\n", (int)args, cc);
36 res ++;
37 return 0;