/****************************************************************************** * FILE: bug5.c * DESCRIPTION: * A simple pthreads program that dies before the threads can do their * work. Figure out why. * AUTHOR: 07/06/05 Blaise Barney * LAST REVISED: 07/11/12 ******************************************************************************/ #include "pthread.cvh" #include #include #include #include #define NUM_THREADS 5 void *PrintHello(void *threadid) { int i; double myresult=0.0; printf("thread=%d: starting...\n", threadid); // Removed l from %ld for (i=0; i<1000000; i++) myresult += sin(i) * tan(i); printf("thread=%d result=%e. Done.\n",threadid,myresult); // Removed l from %ld pthread_exit(NULL); } int main(int argc, char *argv[]) { pthread_t threads[NUM_THREADS]; int rc; long t; for(t=0;t