An adapter object that implements the Runnable interface and delegates to an arbitrary method (one that must have no arguments or return value) in some other object. This allows a class to have multiple methods that will execute asynchronously in their own threads. For example, consider the class:. More...
#include <ThreadStartDelegate.h>
Public Member Functions | |
ThreadStartDelegate (T *object, void(T::*func)()) | |
void | Set (T *object, void(T::*func)()) |
void | CheckMem () const |
void | ValidateMem () const |
An adapter object that implements the Runnable interface and delegates to an arbitrary method (one that must have no arguments or return value) in some other object. This allows a class to have multiple methods that will execute asynchronously in their own threads. For example, consider the class:.
class MyClass { public:
MyClass(); ~MyClass();
void Thread1(); void Thread2(); };
Given an instance of MyClass, the following construct causes a new thread to begin executing in the Thread1() method of that instance.
MyClass mc;
ThreadStartDelegate<MyClass> thread1(&mc, &MyClass::Thread1); thread1.Start();
Definition at line 57 of file ThreadStartDelegate.h.
ThreadStartDelegate< T >::ThreadStartDelegate | ( | T * | object, | |
void(T::*)() | func | |||
) | [inline] |
Construct a new ThreadStartDelegate which will call a method on another object.
object | The object. | |
func | A member function (method) in the object which will be called by run(). |
Definition at line 72 of file ThreadStartDelegate.h.