]> https://gitweb.dealii.org/ - dealii.git/commitdiff
move mutex down 8997/head
authorTimo Heister <timo.heister@gmail.com>
Mon, 4 Nov 2019 15:53:11 +0000 (10:53 -0500)
committerTimo Heister <timo.heister@gmail.com>
Mon, 4 Nov 2019 19:07:56 +0000 (14:07 -0500)
include/deal.II/base/mpi_compute_index_owner_internal.h

index b2e63c0a3498bc9d31b6985437fdb64e4a060212..3587b2b31e1f9a8576f336310ddaa873af087e97 100644 (file)
@@ -119,10 +119,6 @@ namespace Utilities
             this->partition(owned_indices, comm);
 
 #ifdef DEAL_II_WITH_MPI
-
-            static CollectiveMutex      mutex;
-            CollectiveMutex::ScopedLock lock(mutex, comm);
-
             unsigned int my_rank = this_mpi_process(comm);
 
             types::global_dof_index dic_local_received = 0;
@@ -188,6 +184,10 @@ namespace Utilities
                   }
               }
 
+            // protect the following communication steps using a mutex:
+            static CollectiveMutex      mutex;
+            CollectiveMutex::ScopedLock lock(mutex, comm);
+
             n_dict_procs_in_owned_indices = buffers.size();
             std::vector<MPI_Request> request;
             request.reserve(n_dict_procs_in_owned_indices);

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.