]> https://gitweb.dealii.org/ - dealii.git/commitdiff
RemotePointEvaluation: fix race condition if called multiple times 12364/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 14:35:25 +0000 (16:35 +0200)
include/deal.II/base/mpi_remote_point_evaluation.h

index ebd3f3a5b8a513e27c7cc6020e62900570ca869a..182b779d5ac0d1f9b055c9ac5cb3abf32ed4b8da 100644 (file)
@@ -266,6 +266,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);
@@ -377,6 +380,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.