9 unsigned numberOfProcessors;
12 pthread_t compute_thread;
13 pthread_mutex_t mutex_runstate;
14 RUNSTATE runstate = RUN;
16 void Thread_Cleanup(void)
20 pthread_join(compute_thread, NULL);
23 // This is main function. Do not change it.
24 int main(int argc, char** argv)
28 printf("Please provide the filename, i.e. \'%s bodiesfield.dat\'\n", argv[0]);
33 System_Init(&universe,argv[1]);
34 atexit(Universe_Cleanup);
38 numberOfProcessors = atoi(argv[2]);
41 atexit(Thread_Cleanup);
43 // Create a thread to handle computation loop
45 if (pthread_create(&compute_thread, NULL, Compute_Thread, (void*)&universe) != 0)
47 perror("Error creating compute thread");
51 Graphics_Run(argc, argv); // Run graphics loop in the main thread
54 //We get to this point when the "close" button is clicked in the graphics window
56 pthread_join(compute_thread, NULL);