]> https://gitweb.dealii.org/ - dealii.git/commitdiff
RemotePointEvaluation: fix race condition if called multiple times 12363/head
authorPeter Munch <peterrmuench@gmail.com>
Mon, 31 May 2021 11:35:55 +0000 (13:35 +0200)
committerPeter Munch <peterrmuench@gmail.com>
Mon, 31 May 2021 11:35:55 +0000 (13:35 +0200)
include/deal.II/base/mpi_remote_point_evaluation.h

index 96da515be3b638caf86b7fe6b92c4eae1fce04d8..4734b19bd04f28f67aef5f16ee5cd48c3e0f5db5 100644 (file)
@@ -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<T> 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<unsigned int, std::vector<T>> temp_recv_map;

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.