mercredi 3 février 2016

How do I "clear" std::promise?

I have a program, which should in cycle launch 8 threads, which will return a value using std::promise. So I think I need to create a vector of 8 promise objects, get their futures, and use these promises to return the values and then join the threads with main. The problem is this: on the next iteration I will create 8 more threads -- can i reuse the same promise objects, or do I need to create 8 more? I haven't found any way to reuse them on the internet, but maybe I'm missing something obvious?

Aucun commentaire:

Enregistrer un commentaire