I have startSending procedure and a friend function (sending
) inside sender
class. I want to call the friend function from a new thread, so I create a new thread inside startSending
procedure.
class sender{
public:
void startSending();
friend void* sending (void * callerobj);
}
void sender::startSending(){
pthread_t tSending;
pthread_create(&tSending, NULL, sending(*this), NULL);
pthread_join(tSending, NULL);
}
void* sending (void * callerobj){
}
But I got this error
cannot convert ‘sender’ to ‘void*’ for argument ‘1’ to ‘void* sending(void*)’
What is the correct way to call sending from pthread_create?