Hi all!
My base classes are:
class Manager: public QThread
class Worker: public QThread
To copy to clipboard, switch view to plain text mode
Manager starts 4 (independed) workers and "listens" for their signals (and counts finished workers). Manager restarts workers several times.
It also emits final results to GUI thread.
This is all working flawless.
Now, i want to loop whole job (manager's job) in Tester thread.
void Tester::run(void)
{
for (int iParam1 = 0; iParam1 < parameter1.size(); iParam1++)
{
for (int iParam2 = 0; iParam2 < parameter2.size(); iParam2++)
{
double tmpValueSum = 0.0;
for (int iRun = 0; iRun < numberOfRuns; iRun++)
{
manager->parameter1 = parameter1[iParam1];
manager->parameter2 = parameter2[iParam2];
manager->run();
manager->wait(); // This is a problem
}
results[iParam1][iParam2] = tmpValueSum / double(numberOfRuns);
}
}
}
void Tester::run(void)
{
for (int iParam1 = 0; iParam1 < parameter1.size(); iParam1++)
{
for (int iParam2 = 0; iParam2 < parameter2.size(); iParam2++)
{
double tmpValueSum = 0.0;
for (int iRun = 0; iRun < numberOfRuns; iRun++)
{
manager->parameter1 = parameter1[iParam1];
manager->parameter2 = parameter2[iParam2];
manager->run();
manager->wait(); // This is a problem
}
results[iParam1][iParam2] = tmpValueSum / double(numberOfRuns);
}
}
}
To copy to clipboard, switch view to plain text mode
I miss something in the way I understood wait function. I tried exit(), quit() and exec() in Manager...
What modifications should be implemented to make this possible?
In base case, i only have manager->run(); and there is no need for waiting... Manager emits some output and final results to GUI thread.
Thanks!
EDIT: I found this example
.
As I see it, the only important difference is that my thread raises other threads and have few connections...
Bookmarks