Possible Duplicate:
pthread Function from a Class
I am trying to create a thread with a start routine, but g++ does not like my syntax.
class myClass
{
void* myFunction(void* myArg)
{
// some code, useless here
}
void start()
{
pthread_t thread_id;
int* fd;
//Some code, useless here.
pthread_create(&thread_id, 0, &myFunction, (void*) fd);
}
}
During compilator, g++ tells me that ISO C++ forbids taking the address of an unqualified or parenthesized non-static member function to form a pointer to member function. Say '&myFunction'.
It cannot convert void (myClass::*) (void*) to void* (*) (void*) for argument 3 of pthread_create.
Any idea ?