mardi 24 février 2015

How to pass a function to an already created thread

I am creating a thread in a c++ program as following:



threadList.push_back(std::thread(factor, Ap, Ai, Ax, b, Q, P, Pinv, n, 0, 5000));


The vector threadList is a vector that has all the threads created in the program. and the function factor receives the following parameters: Ap, Ai, Ax, b, Q, P, Pinv, n, 0, 5000


I am trying to use this thread (after function factor is done) for another function instead of creating a new thread and add additional over head to the code. Is there a way of doing it ?


Aucun commentaire:

Enregistrer un commentaire