I'm trying to create my own Thread class so that I don't have to operate directly on native functions, but I'm a little bit stuck with pthread_create function, as it doesn't seem to accept a pointer to a method. Is there a way to cast it somehow in a way it works? I currently get an error saying "cannot convert ‘Thread::run’ from type ‘void* (Thread::)(void*)’ to type ‘void* ()(void)’"
class Thread {
pthread_t handle;
protected:
bool endThread;
public:
virtual ~Thread() {
}
void start() {
endThread = false;
pthread_create(&handle, NULL, Thread::run, NULL);
}
void stop() {
endThread = true;
}
void join() {
pthread_join(handle, NULL);
}
virtual void* run(void * param) {
return NULL;
}
};