|
OpenTop 1.3 | |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | Cross-Platform C++ | ||||
SUMMARY: CONSTRUCTOR | METHOD | DETAIL: CONSTRUCTOR | METHOD |
#include "ot/base/Runnable.h"
To execute a Runnable class's run() method, create a new Thread instance passing a pointer to the Runnable object as a parameter.
For example here is a complete, but trivial, multi-threaded application that does not need to subclass the Thread class.
#include "ot/base/SystemMonitor.h" #include "ot/base/Thread.h" #include "ot/io/Console.h" using namespace ot; using namespace ot::io; class HelloSayer : public Runnable { public: virtual void run() { Console::Out()->println(OT_T("Hello World!")); } }; int main() { SystemMonitor monitor; // ensures correct termination processing RefPtr<Thread> rpThread = new Thread(new HelloSayer); rpThread->start(); return 0; }
Method Summary | |
virtual void |
run()=0 Called by a Thread's start-up function when it has been initiated. |
Methods inherited from class ot::ManagedObject |
addRef, getRefCount, onFinalRelease, operator=, release |
Method Detail |
virtual void run()=0
|
OpenTop 1.3 | |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | Cross-Platform C++ | ||||
SUMMARY: CONSTRUCTOR | METHOD | DETAIL: CONSTRUCTOR | METHOD |