Skip to content

Commit fbc77ff

Browse files
authored
Merge pull request #47201 from Dr15Jones/removeOMP
Remove use of OpenMP threading
2 parents 502e64b + 070e8cb commit fbc77ff

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

CommonTools/Utils/test/BuildFile.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
<ifrelease name="ASAN">
3636
<flags NO_TEST_PREFIX="1"/>
3737
</ifrelease>
38-
<flags CXXFLAGS="-fopenmp"/>
3938
<use name="CommonTools/Utils"/>
4039
</bin>
4140

CommonTools/Utils/test/ExpressionEvaluatorUnitTest.cpp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include <iostream>
1010
#include <atomic>
11+
#include <thread>
1112

1213
int main() {
1314
// build fake test package...
@@ -75,15 +76,25 @@ int main() {
7576

7677
// stress test
7778
std::atomic<int> j(0);
78-
#pragma omp parallel num_threads(2)
79-
{
79+
//wait for both threads to start before running the test
80+
std::atomic<int> waitForAll(2);
81+
82+
auto work = [&]() {
83+
--waitForAll;
84+
while (waitForAll > 0)
85+
;
8086
reco::genericExpression<bool, int, int> const* acut = nullptr;
8187
for (int i = 0; i < 20; ++i) {
8288
acut = reco_expressionEvaluator("CommonTools/Utils", SINGLE_ARG(reco::genericExpression<bool, int, int>), cut);
8389
(*acut)(2, 7);
8490
std::cerr << j++ << ',';
8591
}
86-
}
92+
};
93+
94+
std::thread t1(work);
95+
std::thread t2(work);
96+
t1.join();
97+
t2.join();
8798
std::cerr << std::endl;
8899

89100
std::cout << "If HERE OK" << std::endl;

0 commit comments

Comments
 (0)