25 #ifndef CLASSMETHODTHREAD_H_
26 #define CLASSMETHODTHREAD_H_
42 ,
class UserArgs = void
44 ,
class MutexImpl = STTCL_DEFAULT_MUTEXIMPL
64 : threadInstance(argThreadInstance)
65 , instance(argInstance)
66 , threadMethod(argThreadMethod)
67 , userArgs(argUserArgs)
70 RunArgs(
const RunArgs& rhs)
71 : threadInstance(rhs.threadInstance)
72 , instance(rhs.instance)
73 , threadMethod(rhs.threadMethod)
74 , userArgs(rhs.userArgs)
77 RunArgs& operator=(
const RunArgs& rhs)
79 threadInstance = rhs.threadInstance;
80 instance = rhs.instance;
81 threadMethod = rhs.threadMethod;
82 userArgs = rhs.userArgs;
97 , runArgs(this,argInstance,argThreadMethod)
114 bool run(UserArgs* userArgs = 0)
118 runArgs.userArgs = userArgs;
139 static void* internalThreadMethod(
void* args)
142 RunArgs* runArgs =
reinterpret_cast<RunArgs*
>(args);
148 thisPtr->running =
true;
150 T* instance = runArgs->instance;
152 result = (instance->*threadMethod)(runArgs->userArgs);
154 thisPtr->running =
false;
162 ClassMethodThread<T,UserArgs,ThreadImpl>& operator=(
const ClassMethodThread<T,UserArgs,ThreadImpl>& rhs);
166 MutexImpl threadMutex;