mardi 1 octobre 2019

how to invoke thread without creating static function

I have a code that looks like this

class foo
{
    public:
    foo();
    ~foo();
    process(); 
};

int main()
{
    foo myfoo1;
    foo myfoo2;

    std::thread firstthread(myfoo1.process());
    std::thread secondthread(myfoo2.process());
    return 0;
}

This is the error that I am getting

'std::invoke': no matching overloaded function found    Disparity   

I know that compiler is complaining because process() is not static but this involves making major changes to the class and I would like not to go that route. Any other hint on how to start the tread?

Aucun commentaire:

Enregistrer un commentaire