Commit 4527983f authored by Praetorius, Simon's avatar Praetorius, Simon

wait_all_apply added

parent 62e67374
......@@ -25,6 +25,27 @@ namespace mpi14
}
}
template <class ReqIter, class Apply>
void wait_all_apply(ReqIter first, ReqIter last, Apply apply)
{
std::list<ReqIter> remaining;
for (ReqIter it = first; it != last; ++it) remaining.push_back(it);
while (!remaining.empty()) {
auto remove_it = remaining.end();
for (auto it = remaining.begin(); it != remaining.end(); ++it) {
if ((*it)->test()) {
apply(*it); // call a functor with the request iterator
remove_it = it;
break;
}
}
if (remove_it != remaining.end())
remaining.erase(remove_it);
}
}
template <class ReqIter>
void wait_all_weak(ReqIter first, ReqIter last)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment