mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-09-22 06:13:13 +08:00
Use EIGEN_THREAD_YIELD instead of std::this_thread::yield to make the code more portable.
This commit is contained in:
parent
2dde1b1028
commit
32ffce04fc
@ -95,7 +95,7 @@ static void test_stress_eventcount()
|
|||||||
ec.Notify(false);
|
ec.Notify(false);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
std::this_thread::yield();
|
EIGEN_THREAD_YIELD();
|
||||||
j--;
|
j--;
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
@ -184,7 +184,7 @@ void test_stress_runqueue()
|
|||||||
sum += j;
|
sum += j;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
std::this_thread::yield();
|
EIGEN_THREAD_YIELD();
|
||||||
j--;
|
j--;
|
||||||
}
|
}
|
||||||
total += sum;
|
total += sum;
|
||||||
@ -194,7 +194,7 @@ void test_stress_runqueue()
|
|||||||
std::vector<int> stolen;
|
std::vector<int> stolen;
|
||||||
for (int j = 1; j < kEvents;) {
|
for (int j = 1; j < kEvents;) {
|
||||||
if (q.PopBackHalf(&stolen) == 0) {
|
if (q.PopBackHalf(&stolen) == 0) {
|
||||||
std::this_thread::yield();
|
EIGEN_THREAD_YIELD();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
while (stolen.size() && j < kEvents) {
|
while (stolen.size() && j < kEvents) {
|
||||||
@ -209,7 +209,7 @@ void test_stress_runqueue()
|
|||||||
int v = stolen.back();
|
int v = stolen.back();
|
||||||
stolen.pop_back();
|
stolen.pop_back();
|
||||||
VERIFY_IS_NOT_EQUAL(v, 0);
|
VERIFY_IS_NOT_EQUAL(v, 0);
|
||||||
while ((v = q.PushBack(v)) != 0) std::this_thread::yield();
|
while ((v = q.PushBack(v)) != 0) EIGEN_THREAD_YIELD();
|
||||||
}
|
}
|
||||||
total -= sum;
|
total -= sum;
|
||||||
}));
|
}));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user