pthread_create
The 3 rd argument to pthead_create is a function pointer.
and the format is void *(*start_routine) ( void *).
I want to use the class method as a start_routine.
I have defined a class called Handler which consist of a method
void* Handler :: ThreadHandler (void *);
I have tried to use as follows:
my code ...
.
.
.
pthread_t ThId;
int Id;
Handler objHandler;
.
.
.
pthread_create ( &ThId , NULL , &(objHandler.*ThreadHandler), &Id );
but it gives error of type miss match for 3rd argument.
Can I use this method as start_routine for thread .
Please let me know if there is another way to achive this.
|