Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

MCRunnable Class Reference

Base class used to provide a method which a thread can run. More...

#include <mcllib/MCRunnable.h>

Inheritance diagram for MCRunnable:

MCRefCount List of all members.

Public Member Functions

virtual bool run ()=0
 Interface to runnables.
virtual ~MCRunnable ()
 Allow virtual delete.

Detailed Description

Base class used to provide a method which a thread can run.

When the run() function return the thread exits. Typical usage is

class MyRunnable : public MCRunnable {
 public:
   virtual bool run() {
     ... do some work ...
     return true;
   }
 }
 MCThread thr("test");         // create a thread object
 thr.start(new MyRunnable);    // start the thread running (calls run())
 thr.join();                   // wait for the run() function to complete
 


Member Function Documentation

virtual bool run  )  [pure virtual]
 

Interface to runnables.

The implementation must override the run function. The framework calls run when the thread has been started. The status returned from the run function indicates success or failure.

Returns:
true to indicate success, false to indicate failure


Generated on Wed Jan 12 19:05:50 2005 for MCLLIB by  doxygen 1.3.9.1