// threadtest.cc // Implements the solution to the problem of the smokers !! // #include "copyright.h" #include "system.h" #define TOBACCO 1 #define PAPER 2 #define MATCHES 3 // Class defining a smoker. You can add more data/function members, if you need/want class Smoker { public: // Constructs a smoker x who has item n available to him/her Smoker(int x, int n); //the destructor ~Smoker(); //Let the smoker smoke smoke(); private: int id; // The unique id of the smoker int item; // the item which this smoker has // Add data here, if necessary. }; class agent{ public: agent(); // Creates an agent void run(); // Let's the agent do it's work private: // Add something if you need to }; //---------------------------------------------------------------------- // ThreadTest // Body has been replaced with the code to start the agent //---------------------------------------------------------------------- void ThreadTest() { DEBUG('t', "Entering the smoking zone !! - Smoking is injurious to health"); // Start the agent..... agent *xyz; //add code here // Initialize the smokers smoker a(1,TOBACCO); smoker b(2,PAPER); smoker c(3,MATCHES); // Let the smokers smoke to death.......add the necessary code while (true) { currentThread->Yield(); } }