Logo Search packages:      
Sourcecode: pwlib version File versions  Download package

void MyThread2::Main (  ) [inline, virtual]

User override function for the main execution routine of the thread. A descendent class must provide the code that will be executed in the thread within this function.

Note that the correct way for a thread to terminate is to return from this function.

Implements PThread.

Definition at line 106 of file thread.cxx.

References PSync::Signal(), PThread::Sleep(), and PSync::Wait().

                {
      while (1) {
        // Check if we need to exit
        exitMutex.Wait();
        if (exitFlag == TRUE) {
          exitMutex.Signal();
          break;
        }
        exitMutex.Signal();

        // Display the number 2, then sleep for a short time
        printf("2 "); fflush(stdout);
      Sleep(10); // sleep 10ms
      }
    }

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index