class Scoreget{ private: //some variables public: Scoreget(){ //something here } void* basicgetscore(){ //somthing here } void getscore(Scoreget s){ pthread_t t; if(pthread_create(&t,NULL,s.basicgetscore,NULL)==-1){ printf("Error 3\n"); exit(3); } void *a; if(pthread_join(t,&a)==-1){ printf("Error \n); exit(4); } } };
I am trying to start a separate thread to call a function because it uses the execl () call and thus stops my program (I am in windows and cannot use fork ()). Combining threads with classes gives me tough times.
From some googling, I realized that I need to make this last friend a function or static and use some kind of this pointer. I tried on my part, but the pieces do not fit together. I canβt even change the type of error. Now it upsets me. Getting the same error:
cannot convert Scoreget :: basicgetscore from type void * (Scoreget ::) () to input void * (*) (void *)
c ++ multithreading
vish213
source share