fix affinity test

This commit is contained in:
Guenter Obiltschnig
2015-03-20 09:50:56 +01:00
parent 84842e9eea
commit f481a4c92f

View File

@@ -460,7 +460,6 @@ void ThreadTest::testAffinity()
std::stringstream ss; std::stringstream ss;
unsigned cpuCount = Poco::Environment::processorCount(); unsigned cpuCount = Poco::Environment::processorCount();
unsigned usedCpu = 0; unsigned usedCpu = 0;
bool notImplemented = false;
std::vector<Thread*> threadList; std::vector<Thread*> threadList;
Thread* thread = NULL; Thread* thread = NULL;
std::vector<MyRunnable*> runnableList; std::vector<MyRunnable*> runnableList;
@@ -484,27 +483,10 @@ void ThreadTest::testAffinity()
for (int i = 0; i < cpuCount; i++) for (int i = 0; i < cpuCount; i++)
{ {
threadList[i]->start(*runnableList[i]); threadList[i]->start(*runnableList[i]);
try threadList[i]->setAffinity(i);
{
threadList[i]->setAffinity(i);
}
catch (Poco::NotImplementedException& niex)
{
notImplemented = true;
}
Thread::sleep(100); Thread::sleep(100);
try usedCpu = threadList[i]->getAffinity();
{ assert (usedCpu == i || usedCpu == -1);
usedCpu = threadList[i]->getAffinity();
}
catch (Poco::NotImplementedException& niex)
{
notImplemented = true;
}
if (!notImplemented)
{
assert (usedCpu == i);
}
} }
for (int i = 0; i < cpuCount; i++) for (int i = 0; i < cpuCount; i++)