From 545c0a65dcb1dc6150ff98d2f341b2923dcf1ba4 Mon Sep 17 00:00:00 2001 From: Peter Munch Date: Mon, 31 May 2021 13:35:55 +0200 Subject: [PATCH] RemotePointEvaluation: fix race condition if called multiple times --- include/deal.II/base/mpi_remote_point_evaluation.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/deal.II/base/mpi_remote_point_evaluation.h b/include/deal.II/base/mpi_remote_point_evaluation.h index 96da515be3..4734b19bd0 100644 --- a/include/deal.II/base/mpi_remote_point_evaluation.h +++ b/include/deal.II/base/mpi_remote_point_evaluation.h @@ -282,6 +282,9 @@ namespace Utilities (void)buffer; (void)evaluation_function; #else + static CollectiveMutex mutex; + CollectiveMutex::ScopedLock lock(mutex, tria->get_communicator()); + output.resize(point_ptrs.back()); buffer.resize(send_permutation.size() * 2); ArrayView buffer_1(buffer.data(), buffer.size() / 2); @@ -399,6 +402,9 @@ namespace Utilities (void)buffer; (void)evaluation_function; #else + static CollectiveMutex mutex; + CollectiveMutex::ScopedLock lock(mutex, tria->get_communicator()); + const auto &ptr = this->get_point_ptrs(); std::map> temp_recv_map; -- 2.39.5