How do I pass member function with object as an argument to pthread_create function?
Example:
class A
{
public:
A(){}
void funcForThread( Person p ) {
//code...
}
void createThread( Person p ) {
pthread_t thread1;
pthread_attr_init ( &attr );
pthread_attr_setdetachstate ( &attr, PTHREAD_CREATE_JOINABLE );
pthread_create ( &thread1, &attr, /* what to write here*/ ); // need to pass funcForThread and Person p object there
}
private:
pthread_attr_t attr;
};