/** * \brief The static function representing the code executed in the thread context. * * This function just calls the run() function of the subclass. * We need this level of indirection because pthread_create() cannot accept * a method which is non static or virtual. * @param param The pointer to the concrete subclass. * @return Always zero. */ void *AbstractThread::Execute(void* param) { AbstractThread* th = reinterpret_cast<AbstractThread*>(param); pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); th->run(); return 0; }
SPHERE_THREADENTRY_RETNTYPE AbstractThread::runner(void *callerThread) { AbstractThread * caller = reinterpret_cast<AbstractThread*>(callerThread); if (caller != NULL) { caller->run(); caller->terminate(true); } return 0; }