#include "thread.h"
Thread::Thread() {}
int Thread::start(void * arg) {
Arg(arg); // store user data
int code = thread_create(Thread::entryPoint, this, &ThreadId_);
return code;
}
int Thread::run(void * arg) {
setup();
execute( arg );
}
/*static */
void * Thread::entryPoint(void * pthis) {
Thread * pt = (Thread*)pthis;
pthis->run( Arg() );
}
virtual void Thread::setup() {
// Do any setup here
}
virtual void Thread::execute(void* arg) {
// Your code goes here
}