// run a function in parallel N times, wait using pthread_join() // // run time is maximum of the run times for each function call // #include #include "common.c" // start the threads // pthread_t t[N]; for( int i = 0; i < N; ++i) if( pthread_create( &t[i], 0, f, &D[i].i ) ) { perror( "pthread_create"); return 1; } // wait until all threads are finished // for( int i = 0; i < N; ++i) pthread_join( t[i], 0); }