Isolated code that fails to compile on gcc
The original changes is in the "refactoring" branch. This branch has removed most of the changes except for the specific parts of code that triggers the compilation to fail on gcc. The minor lambda fn capture change ("function" to "&function") is to fix compiler error with Clang. EDIT: It seems if the UnitTests are compiled with the "Release" build-type instead of "Debug", then gcc does not fail to compile.
This commit is contained in:
parent
dc7c29f7cc
commit
94ba0b70e8
1 changed files with 31 additions and 19 deletions
|
@ -940,7 +940,7 @@ namespace EC
|
||||||
std::get<2>(fnDataAr.at(i)) = {begin, end};
|
std::get<2>(fnDataAr.at(i)) = {begin, end};
|
||||||
std::get<3>(fnDataAr.at(i)) = userData;
|
std::get<3>(fnDataAr.at(i)) = userData;
|
||||||
std::get<4>(fnDataAr.at(i)) = &matching;
|
std::get<4>(fnDataAr.at(i)) = &matching;
|
||||||
threadPool->queueFn([function, helper] (void* ud) {
|
threadPool->queueFn([&function, helper] (void* ud) {
|
||||||
auto *data = static_cast<TPFnDataType*>(ud);
|
auto *data = static_cast<TPFnDataType*>(ud);
|
||||||
for(std::size_t i = std::get<2>(*data).at(0);
|
for(std::size_t i = std::get<2>(*data).at(0);
|
||||||
i < std::get<2>(*data).at(1);
|
i < std::get<2>(*data).at(1);
|
||||||
|
@ -1448,8 +1448,15 @@ namespace EC
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
using TPFnType = std::tuple<Manager*, void*, std::array<std::size_t, 2>, std::vector<std::vector<std::size_t> > *, std::size_t>;
|
struct TPFnDataStruct {
|
||||||
std::array<TPFnType, ThreadCount> fnDataAr;
|
std::array<std::size_t, 2> range;
|
||||||
|
std::size_t index;
|
||||||
|
Manager *manager;
|
||||||
|
void *userData;
|
||||||
|
std::vector<std::vector<std::size_t> >*
|
||||||
|
multiMatchingEntities;
|
||||||
|
};
|
||||||
|
std::array<TPFnDataStruct, ThreadCount> fnDataAr;
|
||||||
std::size_t s = multiMatchingEntities[index].size()
|
std::size_t s = multiMatchingEntities[index].size()
|
||||||
/ ThreadCount;
|
/ ThreadCount;
|
||||||
for(unsigned int i = 0; i < ThreadCount; ++i) {
|
for(unsigned int i = 0; i < ThreadCount; ++i) {
|
||||||
|
@ -1463,30 +1470,35 @@ namespace EC
|
||||||
if(begin == end) {
|
if(begin == end) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
std::get<0>(fnDataAr.at(i)) = this;
|
fnDataAr[i].range = {begin, end};
|
||||||
std::get<1>(fnDataAr.at(i)) = userData;
|
fnDataAr[i].index = index;
|
||||||
std::get<2>(fnDataAr.at(i)) = {begin, end};
|
fnDataAr[i].manager = this;
|
||||||
std::get<3>(fnDataAr.at(i)) = &multiMatchingEntities;
|
fnDataAr[i].userData = userData;
|
||||||
std::get<4>(fnDataAr.at(i)) = index;
|
fnDataAr[i].multiMatchingEntities =
|
||||||
|
&multiMatchingEntities;
|
||||||
threadPool->queueFn([&func] (void *ud) {
|
threadPool->queueFn([&func] (void *ud) {
|
||||||
auto *data = static_cast<TPFnType*>(ud);
|
auto *data = static_cast<TPFnDataStruct*>(ud);
|
||||||
for(std::size_t i = std::get<2>(*data).at(0);
|
for(std::size_t i = data->range[0];
|
||||||
i < std::get<2>(*data).at(1);
|
i < data->range[1]; ++i) {
|
||||||
++i) {
|
if(data->manager->isAlive(
|
||||||
if(std::get<0>(*data)->isAlive(std::get<3>(*data)->at(std::get<4>(*data)).at(i))) {
|
data->multiMatchingEntities
|
||||||
|
->at(data->index).at(i))) {
|
||||||
Helper::call(
|
Helper::call(
|
||||||
std::get<3>(*data)->at(std::get<4>(*data)).at(i),
|
data->multiMatchingEntities
|
||||||
*std::get<0>(*data),
|
->at(data->index).at(i),
|
||||||
|
*data->manager,
|
||||||
func,
|
func,
|
||||||
std::get<1>(*data));
|
data->userData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, &fnDataAr.at(i));
|
}, &fnDataAr[i]);
|
||||||
}
|
}
|
||||||
threadPool->wakeThreads();
|
threadPool->wakeThreads();
|
||||||
do {
|
do {
|
||||||
std::this_thread::sleep_for(std::chrono::microseconds(200));
|
std::this_thread::sleep_for(
|
||||||
} while(!threadPool->isQueueEmpty() || !threadPool->isAllThreadsWaiting());
|
std::chrono::microseconds(200));
|
||||||
|
} while(!threadPool->isQueueEmpty()
|
||||||
|
|| !threadPool->isAllThreadsWaiting());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue