void IsIntersection(int x, int y) { int win_x = CheckX(x); int win_y = CheckY(y); if(win_x == YES && win_y == YES) { WinMessage(); display_type = PAUSE; NewGame(); } }
// MAIN routine main( int argc, char **argv ) { // Elapsed times using <times()> clock_t clkStart; clock_t clkStop; // CPU times for the threads struct tms tStart; struct tms tStop; int k; int i; int j; int temp; double max; vFlag = 0; GetParam( argc, argv ); printf( "Starting timing ... computing ...\n" ); clkStart = times( &tStart ); long threadCounter; for( threadCounter = 0; threadCounter < M; threadCounter++ ) { thread_data_arry[ threadCounter ].i = 0; thread_data_arry[ threadCounter ].b = N; thread_data_arry[ threadCounter ].thread_id = threadCounter; printf( "\tmain: creating thread %ld\n", threadCounter ); int threadReturnCode = pthread_create( &idThreads[ threadCounter ], NULL, rowMcol, (void *) &thread_data_arry[ threadCounter ]); if( threadReturnCode ) { printf( "ERROR; return code from pthread_create() is %d\n", threadReturnCode ); exit( -1 ); } } printf( "\tcompleted thread creation ... going to try to join all threads!\n" ); // for loop processes until all threads terminate for( threadCounter = 0; threadCounter < M; threadCounter++ ) { pthread_join( idThreads[ threadCounter ], NULL ); } printf( "\tall threads have terminated!\n" ); clkStop = times( &tStop ); printf( "Stopped timing.\n" ); if( N < MAXN4print ) { PrintX(); } if( vFlag == 1 ) { CheckX(); } printf( "Elapsed time = %g ms.\n", (float)( clkStop - clkStart ) / (float) sysconf( _SC_CLK_TCK ) * 1000 ); printf( "The total CPU time comsumed = %g ms.\n", (float)(( tStop.tms_utime - tStart.tms_utime ) + ( tStop.tms_stime - tStart.tms_stime )) / (float)sysconf( _SC_CLK_TCK ) * 1000 ); // Last thing that main() should do pthread_exit( NULL ); return 0; }