cannot convert from type void*(classname::) () to type void*(*)(void*)

前端 未结 3 1040
情深已故
情深已故 2021-02-15 15:16
class Scoreget{
    private:
        //some variables
    public:
        Scoreget(){
            //something here
        }

        void* basicgetscore(){
                     


        
3条回答
  •  太阳男子
    2021-02-15 15:38

    You can't pass non static method to pthread_create

    The most simple way, create static method which would run basicgetscore

    Something like this

    static void *Scoreget::basicgetscore_starter(void *p) {
        Scoreget *t = (Scoreget *)p;
        t->basicgetscore();
    }
    
    pthread_create(&t,NULL,&Scoreget::basicgetscore_starter,(void *)&s);
    

提交回复
热议问题