Example : Hello.C

Classes/Techniques Demonstrated :

Hello.C is a simple program which demonstrates the basics of the HPCxx_Thread class. It creates a thread, which simply prints "hello", then dies. The sleep is present to ensure that the thread has time to initialize itself and execute before the main program terminates. Otherwise it won't get to deliver its vital message.
class MyThread : public HPCxx_Thread {
   char *x;

   public:
      MyThread(char *y): x(y),HPCxx_Thread(){}
      void run() { cout << x << endl << flush; }
};

int main(int argc, char **argv)
{
   HPCxx_Group *g;
   hpcxx_init(argc, argv, g);

   MyThread *t1 = new MyThread("hello\n");
   t1->start();
   sleep(5);

   cout << "DONE" << endl;
   return hpcxx_exit(g);
}

    

hpc++@extreme.indiana.edu

Last modified: Thu Apr 22 02:11:48 EST 1999