mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-28 11:31:53 +01:00
fix affinity test
This commit is contained in:
@@ -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++)
|
||||||
|
|||||||
Reference in New Issue
Block a user