- mut_->lock();
- // This (simulated) mutex ensures that no process pushes to the vector of requests during the waitall.
- // Without this, the vector could get redimensioned when another process pushes.
- // This would result in the array used by Request::waitall() to be invalidated.
- // Another solution would be to copy the data and cleanup the vector *before* Request::waitall
-
- // start all requests that have been prepared by another process
- if (not requests_.empty()) {
- int size = static_cast<int>(requests_.size());
- MPI_Request* treqs = requests_.data();
- Request::waitall(size, treqs, MPI_STATUSES_IGNORE);
- }