I am just learning how to use std::thread on c++11. Basically I have a long list of data (imagine a for loop between 0-15000) and 1568 threads in the hardware i am using. I want to each sample to be processed on a thread. I understand how to create the first 1568 threads, it works fine. But once I reach the N_thread+1 sample I then want to check to see if there are any available threads and then if there are send that data sample to that thread. Each thread is sent to a mutex locked function which unlocks at the end. Prehaps I have misunderstood how threads work and cannot do things this way? Or prehaps there is a better threading/cpu assigning library that can help?
As I said I can get to the point were the 1568 threads are created and run and join and the end results are good. Just need a bit more information.
Aucun commentaire:
Enregistrer un commentaire