// Tsp.h: class definitions #include const MAXQSIZE = 100000; const MAXCITIES = 25; class Path { public: int visited; // Number of cities in the partial path int length; // Current length of partial path int city[MAXCITIES]; // Array city[] is a permutation of all cities. // city[0]..city[visited-1] is the current partial path; // city[visited]..city[NumCities-1] are the cities not yet in the path Path(); // Initialize a Path with city 0 visited void AddCity (int i); // Extends path by adding the ith city // not yet visited. void Print(); }; class Queue { // Arguably this could not be called a priority queue; // a real implementation is left as an exercise int size; Path *path[MAXQSIZE]; // for syncronization: int waiting; pthread_mutex_t Qlock; pthread_cond_t Qcond; public: Queue() { size=0; pthread_mutex_init(&Qlock, NULL); pthread_cond_init(&Qcond, NULL); }; void Put(Path *P); Path *Get(); int isEmpty() { return size==0; }; };