X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=course%2Fsemester2%2Fpprog%2Fassignment1%2Fmthread%2Fnbody.h;h=7abe52504edb50343d6af1e4cc673216f4e48f2f;hb=46fe12165ce898eb47d2a2b9ce9945dbd65987a6;hp=595012637908739db12a6932b15d94ec56cd7bed;hpb=19d5190c55a836926f2bd646e043fcd6c61ab919;p=matches%2Fhonours.git diff --git a/course/semester2/pprog/assignment1/mthread/nbody.h b/course/semester2/pprog/assignment1/mthread/nbody.h index 59501263..7abe5250 100644 --- a/course/semester2/pprog/assignment1/mthread/nbody.h +++ b/course/semester2/pprog/assignment1/mthread/nbody.h @@ -10,7 +10,9 @@ #define DEFAULT_WORKING_THREADS 2 -#define PERSISTENT_THREADS //If defined, threads will not be continually destroyed and then respawned +//#define PERSISTENT_THREADS //If defined, threads will not be continually destroyed and then respawned + + //Undefine default macros, replace with functions #undef Simulation_Run @@ -26,10 +28,12 @@ void AfterDraw(); void * Compute_Thread(void * system); //Thread - Continuously perform computations for a System of bodies. May spawn additional worker threads. +#ifdef PERSISTENT_THREADS +void * Worker_Thread(void * arg); +#else void * Force_Thread(void * system); //Thread - Compute forces for all objects in a system void * Position_Thread(void * system); //Thread - Compute positions for all objects in a system - - +#endif //PERSISTENT_THREADS void Thread_Cleanup(void); //Called at program exit to safely join computation thread