With most errors I often have some idea in what direction I need to head to it, but here I have no idea.
So let's start with the breakpoint itself:
There are relatively few times any interactions are mad using the thread library, here are all of them: The inclusion:
#include <thread>
The usage:
void evolve(double* bestN, double* bestP, double* bestM, double* bestQ, double* bestWinConstant) {
std::thread threadArray[threadAmount];
for (int i = 0; i < 100000; i++) {
for (int t = 0; t < threadAmount; t++) {
if (gameArrayInUse[t] == 0) {
copyArray(gameArray[t], startArray);
gameArrayInUse[t] = 1;
threadArray[t] = std::thread(playGames, i, t);
std::cout << "------------New Thread Spawned, No: " << t << std::endl;
break;
}
if (t == threadAmount - 1) {
t = -1;
}
}
}
for (int i = 0; i < threadAmount; i++)
{
std::cout << "JOIN THREADS--------------------------------------------------" << std::endl;
threadArray[i].join();
}
}
The error as seen in the console is (should be noted this changes every time):
Start of evolution on magnitude:1
------------New Thread Spawned, No: 0Completed:
0.000000%
------------New Thread Spawned, No: 1
Compl
Due to my lacking knowledge about this I apologise if you find the content I provide about my code lacking in certain areas, I would implore you to inform me via a comment so I can amend it.