Parallel Programming - Tidied things up
[matches/honours.git] / course / semester2 / pprog / assignment1 / mthread / main.c
deleted file mode 100644 (file)
index 531624616e1c2a271d827fc3e47fe60fedc8e742..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1,59 +0,0 @@
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <pthread.h>
-
-#include "nbody.h"
-#include "graphics.h"
-
-unsigned numberOfProcessors;
-
-System universe;
-pthread_t compute_thread;
-pthread_mutex_t mutex_runstate;
-RUNSTATE runstate = RUN;
-
-void Thread_Cleanup(void)
-{
-       if (runstate == RUN)
-               QuitProgram(false);
-       pthread_join(compute_thread, NULL);
-}
-
-// This is main function. Do not change it.
-int main(int argc, char** argv)
-{
-       if (argc < 2) 
-       {
-               printf("Please provide the filename, i.e. \'%s bodiesfield.dat\'\n", argv[0]);
-               exit(EXIT_FAILURE);
-       }
-       if (argc == 2)
-       {
-               System_Init(&universe,argv[1]);
-               atexit(Universe_Cleanup);
-       }
-       if (argc == 3) 
-       {
-               numberOfProcessors = atoi(argv[2]);
-       }
-       
-       atexit(Thread_Cleanup);
-       
-       // Create a thread to handle computation loop
-       
-       if (pthread_create(&compute_thread, NULL, Compute_Thread, (void*)&universe) != 0)
-       {
-               perror("Error creating compute thread");
-               exit(EXIT_FAILURE);
-       }
-       
-       Graphics_Run(argc, argv); // Run graphics loop in the main thread
-       
-       printf("Close!\n");
-       //We get to this point when the "close" button is clicked in the graphics window
-       QuitProgram(false);
-       pthread_join(compute_thread, NULL);
-       
-}
-
new file mode 120000 (symlink)
index 0000000000000000000000000000000000000000..37e5985321bbd9f9ade691e08d60d5122cd91e5f
--- /dev/null
@@ -0,0 +1 @@
+../single-thread/main.c
\ No newline at end of file

UCC git Repository :: git.ucc.asn.au