diff options
author | Anas Nashif <anas.nashif@intel.com> | 2012-10-30 15:39:57 -0700 |
---|---|---|
committer | Anas Nashif <anas.nashif@intel.com> | 2012-10-30 15:39:57 -0700 |
commit | 035c7fabc3b82cbc9a346c11abe2e9462b4c0379 (patch) | |
tree | 7e40f5a790eae329a8c5d3e59f046451767956ff /Modules/CheckForPthreads.c | |
download | cmake-035c7fabc3b82cbc9a346c11abe2e9462b4c0379.tar.gz cmake-035c7fabc3b82cbc9a346c11abe2e9462b4c0379.tar.bz2 cmake-035c7fabc3b82cbc9a346c11abe2e9462b4c0379.zip |
Imported Upstream version 2.8.9upstream/2.8.9
Diffstat (limited to 'Modules/CheckForPthreads.c')
-rw-r--r-- | Modules/CheckForPthreads.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/Modules/CheckForPthreads.c b/Modules/CheckForPthreads.c new file mode 100644 index 000000000..d83107851 --- /dev/null +++ b/Modules/CheckForPthreads.c @@ -0,0 +1,38 @@ +#include <stdio.h> +#include <pthread.h> +#include <unistd.h> + +void* runner(void*); + +int res = 0; +#ifdef __CLASSIC_C__ +int main(){ + int ac; + char*av[]; +#else +int main(int ac, char*av[]){ +#endif + pthread_t tid[2]; + pthread_create(&tid[0], 0, runner, (void*)1); + pthread_create(&tid[1], 0, runner, (void*)2); + +#if defined(__BEOS__) && !defined(__ZETA__) && !defined(__HAIKU__) // (no usleep on BeOS 5.) + usleep(1); // for strange behavior on single-processor sun +#endif + + pthread_join(tid[0], 0); + pthread_join(tid[1], 0); + if(ac > 1000){return *av[0];} + return res; +} + +void* runner(void* args) +{ + int cc; + for ( cc = 0; cc < 10; cc ++ ) + { + printf("%d CC: %d\n", (int)args, cc); + } + res ++; + return 0; +} |