mirror of
https://github.com/pocoproject/poco.git
synced 2025-04-01 09:24:55 +02:00
fix affinity test
This commit is contained in:
parent
84842e9eea
commit
f481a4c92f
@ -460,7 +460,6 @@ void ThreadTest::testAffinity()
|
||||
std::stringstream ss;
|
||||
unsigned cpuCount = Poco::Environment::processorCount();
|
||||
unsigned usedCpu = 0;
|
||||
bool notImplemented = false;
|
||||
std::vector<Thread*> threadList;
|
||||
Thread* thread = NULL;
|
||||
std::vector<MyRunnable*> runnableList;
|
||||
@ -484,27 +483,10 @@ void ThreadTest::testAffinity()
|
||||
for (int i = 0; i < cpuCount; i++)
|
||||
{
|
||||
threadList[i]->start(*runnableList[i]);
|
||||
try
|
||||
{
|
||||
threadList[i]->setAffinity(i);
|
||||
}
|
||||
catch (Poco::NotImplementedException& niex)
|
||||
{
|
||||
notImplemented = true;
|
||||
}
|
||||
threadList[i]->setAffinity(i);
|
||||
Thread::sleep(100);
|
||||
try
|
||||
{
|
||||
usedCpu = threadList[i]->getAffinity();
|
||||
}
|
||||
catch (Poco::NotImplementedException& niex)
|
||||
{
|
||||
notImplemented = true;
|
||||
}
|
||||
if (!notImplemented)
|
||||
{
|
||||
assert (usedCpu == i);
|
||||
}
|
||||
usedCpu = threadList[i]->getAffinity();
|
||||
assert (usedCpu == i || usedCpu == -1);
|
||||
}
|
||||
|
||||
for (int i = 0; i < cpuCount; i++)
|
||||
|
Loading…
x
Reference in New Issue
Block a user