ThreadStartDelegate< T > Class Template Reference

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>

Inheritance diagram for ThreadStartDelegate< T >:
Thread IMemoryValidate

List of all members.

Public Member Functions

 ThreadStartDelegate (T *object, void(T::*func)())
void Set (T *object, void(T::*func)())
void CheckMem () const
void ValidateMem () const

Detailed Description

template<class T>
class ThreadStartDelegate< T >

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.


Constructor & Destructor Documentation

template<class T>
ThreadStartDelegate< T >::ThreadStartDelegate ( T *  object,
void(T::*)()  func 
) [inline]

Construct a new ThreadStartDelegate which will call a method on another object.

Parameters:
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.


The documentation for this class was generated from the following file: