From 529eb5186c88c4fc87874b53f9f535fa2fc21bff Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Tue, 7 Jan 2020 09:54:43 -0500 Subject: [PATCH] Replace Threads::mutex by std::mutex --- include/deal.II/base/flow_function.h | 2 +- include/deal.II/base/function_cspline.h | 2 +- include/deal.II/base/incremental_function.h | 2 +- include/deal.II/base/parallel.h | 2 +- include/deal.II/base/timer.h | 2 +- include/deal.II/fe/fe_poly_tensor.h | 2 +- include/deal.II/fe/fe_system.h | 2 +- include/deal.II/fe/mapping_fe_field.h | 2 +- include/deal.II/fe/mapping_q_eulerian.h | 2 +- include/deal.II/lac/block_matrix_base.h | 4 ++-- include/deal.II/lac/la_parallel_vector.h | 2 +- include/deal.II/lac/lapack_full_matrix.h | 2 +- include/deal.II/lac/precondition.h | 2 +- include/deal.II/lac/scalapack.h | 2 +- include/deal.II/lac/swappable_vector.h | 2 +- include/deal.II/lac/vector_memory.h | 2 +- include/deal.II/lac/vector_memory.templates.h | 2 +- .../deal.II/matrix_free/dof_info.templates.h | 18 +++++++++--------- 18 files changed, 27 insertions(+), 27 deletions(-) diff --git a/include/deal.II/base/flow_function.h b/include/deal.II/base/flow_function.h index 8486837f4d..9696784f33 100644 --- a/include/deal.II/base/flow_function.h +++ b/include/deal.II/base/flow_function.h @@ -128,7 +128,7 @@ namespace Functions /** * A mutex that guards the following scratch arrays. */ - mutable Threads::Mutex mutex; + mutable std::mutex mutex; /** * Auxiliary values for the usual Function interface. diff --git a/include/deal.II/base/function_cspline.h b/include/deal.II/base/function_cspline.h index c058669c9e..febff9b51b 100644 --- a/include/deal.II/base/function_cspline.h +++ b/include/deal.II/base/function_cspline.h @@ -132,7 +132,7 @@ namespace Functions /** * A mutex for accelerator object. */ - mutable Threads::Mutex acc_mutex; + mutable std::mutex acc_mutex; }; } // namespace Functions diff --git a/include/deal.II/base/incremental_function.h b/include/deal.II/base/incremental_function.h index dfb8a6e43f..0680249175 100644 --- a/include/deal.II/base/incremental_function.h +++ b/include/deal.II/base/incremental_function.h @@ -120,7 +120,7 @@ namespace Functions /** * Thread mutex for supporting evaluation in multi-threaded contexts. */ - mutable Threads::Mutex mutex; + mutable std::mutex mutex; }; } // namespace Functions diff --git a/include/deal.II/base/parallel.h b/include/deal.II/base/parallel.h index 07fc76b72c..7376ec70fe 100644 --- a/include/deal.II/base/parallel.h +++ b/include/deal.II/base/parallel.h @@ -773,7 +773,7 @@ namespace parallel /** * A mutex to guard the access to the in_use flag. */ - dealii::Threads::Mutex mutex; + std::mutex mutex; #endif }; } // namespace internal diff --git a/include/deal.II/base/timer.h b/include/deal.II/base/timer.h index fdc03bb4f8..8b6b74d908 100644 --- a/include/deal.II/base/timer.h +++ b/include/deal.II/base/timer.h @@ -911,7 +911,7 @@ private: * A lock that makes sure that this class gives reasonable results even when * used with several threads. */ - Threads::Mutex mutex; + std::mutex mutex; }; diff --git a/include/deal.II/fe/fe_poly_tensor.h b/include/deal.II/fe/fe_poly_tensor.h index fef42ba72c..294bc6e80d 100644 --- a/include/deal.II/fe/fe_poly_tensor.h +++ b/include/deal.II/fe/fe_poly_tensor.h @@ -492,7 +492,7 @@ protected: /** * A mutex to be used to guard access to the variables below. */ - mutable Threads::Mutex cache_mutex; + mutable std::mutex cache_mutex; /** * If a shape function is computed at a single point, we must compute all of diff --git a/include/deal.II/fe/fe_system.h b/include/deal.II/fe/fe_system.h index 3500beb738..cb5777bb36 100644 --- a/include/deal.II/fe/fe_system.h +++ b/include/deal.II/fe/fe_system.h @@ -1231,7 +1231,7 @@ private: /** * Mutex for protecting initialization of restriction and embedding matrix. */ - mutable Threads::Mutex mutex; + mutable std::mutex mutex; friend class FE_Enriched; }; diff --git a/include/deal.II/fe/mapping_fe_field.h b/include/deal.II/fe/mapping_fe_field.h index 4930988eca..4f1e23d22f 100644 --- a/include/deal.II/fe/mapping_fe_field.h +++ b/include/deal.II/fe/mapping_fe_field.h @@ -634,7 +634,7 @@ private: /** * A variable to guard access to the fe_values variable. */ - mutable Threads::Mutex fe_values_mutex; + mutable std::mutex fe_values_mutex; void compute_data(const UpdateFlags update_flags, diff --git a/include/deal.II/fe/mapping_q_eulerian.h b/include/deal.II/fe/mapping_q_eulerian.h index bd6ce6b776..670a4d89f3 100644 --- a/include/deal.II/fe/mapping_q_eulerian.h +++ b/include/deal.II/fe/mapping_q_eulerian.h @@ -266,7 +266,7 @@ private: /** * A variable to guard access to the fe_values variable. */ - mutable Threads::Mutex fe_values_mutex; + mutable std::mutex fe_values_mutex; }; }; diff --git a/include/deal.II/lac/block_matrix_base.h b/include/deal.II/lac/block_matrix_base.h index 9e76467aac..43368dd2ed 100644 --- a/include/deal.II/lac/block_matrix_base.h +++ b/include/deal.II/lac/block_matrix_base.h @@ -1040,11 +1040,11 @@ private: * A mutex variable used to guard access to the member variables of this * structure; */ - Threads::Mutex mutex; + std::mutex mutex; /** * Copy operator. This is needed because the default copy operator of this - * class is deleted (since Threads::Mutex is not copyable) and hence the + * class is deleted (since std::mutex is not copyable) and hence the * default copy operator of the enclosing class is also deleted. * * The implementation here simply does nothing -- TemporaryData objects diff --git a/include/deal.II/lac/la_parallel_vector.h b/include/deal.II/lac/la_parallel_vector.h index adc4460a78..b8a2acfe19 100644 --- a/include/deal.II/lac/la_parallel_vector.h +++ b/include/deal.II/lac/la_parallel_vector.h @@ -1393,7 +1393,7 @@ namespace LinearAlgebra * update_ghost_values functions give reasonable results also when used * with several threads. */ - mutable Threads::Mutex mutex; + mutable std::mutex mutex; /** * A helper function that clears the compress_requests and diff --git a/include/deal.II/lac/lapack_full_matrix.h b/include/deal.II/lac/lapack_full_matrix.h index dfba3c534c..10c885bb89 100644 --- a/include/deal.II/lac/lapack_full_matrix.h +++ b/include/deal.II/lac/lapack_full_matrix.h @@ -1003,7 +1003,7 @@ private: /** * Thread mutex. */ - mutable Threads::Mutex mutex; + mutable std::mutex mutex; }; diff --git a/include/deal.II/lac/precondition.h b/include/deal.II/lac/precondition.h index 185a7dce5c..a02eacb1d7 100644 --- a/include/deal.II/lac/precondition.h +++ b/include/deal.II/lac/precondition.h @@ -1210,7 +1210,7 @@ private: * A mutex to avoid that multiple vmult() invocations by different threads * overwrite the temporary vectors. */ - mutable Threads::Mutex mutex; + mutable std::mutex mutex; /** * Initializes the factors theta and delta based on an eigenvalue diff --git a/include/deal.II/lac/scalapack.h b/include/deal.II/lac/scalapack.h index 8579222321..50df0d3b92 100644 --- a/include/deal.II/lac/scalapack.h +++ b/include/deal.II/lac/scalapack.h @@ -985,7 +985,7 @@ private: /** * Thread mutex. */ - mutable Threads::Mutex mutex; + mutable std::mutex mutex; }; // ----------------------- inline functions ---------------------------- diff --git a/include/deal.II/lac/swappable_vector.h b/include/deal.II/lac/swappable_vector.h index 9ce7a36013..6c45f3f7a5 100644 --- a/include/deal.II/lac/swappable_vector.h +++ b/include/deal.II/lac/swappable_vector.h @@ -203,7 +203,7 @@ private: * If not in MT mode, then the class used here is empty, and we can as well * get away with it. */ - Threads::Mutex lock; + std::mutex lock; /** * Flag by which the @p alert function signifies that the data has been diff --git a/include/deal.II/lac/vector_memory.h b/include/deal.II/lac/vector_memory.h index eabcada252..cc721bde3a 100644 --- a/include/deal.II/lac/vector_memory.h +++ b/include/deal.II/lac/vector_memory.h @@ -462,7 +462,7 @@ private: * Mutex to synchronize access to internal data of this object from multiple * threads. */ - static Threads::Mutex mutex; + static std::mutex mutex; }; diff --git a/include/deal.II/lac/vector_memory.templates.h b/include/deal.II/lac/vector_memory.templates.h index f9081291c7..beb406df72 100644 --- a/include/deal.II/lac/vector_memory.templates.h +++ b/include/deal.II/lac/vector_memory.templates.h @@ -38,7 +38,7 @@ GrowingVectorMemory::get_pool() template -Threads::Mutex GrowingVectorMemory::mutex; +std::mutex GrowingVectorMemory::mutex; diff --git a/include/deal.II/matrix_free/dof_info.templates.h b/include/deal.II/matrix_free/dof_info.templates.h index d8f2ffa9ea..ee12196d50 100644 --- a/include/deal.II/matrix_free/dof_info.templates.h +++ b/include/deal.II/matrix_free/dof_info.templates.h @@ -1442,11 +1442,11 @@ namespace internal static constexpr unsigned int bucket_size_threading = 256; void - compute_row_lengths(const unsigned int begin, - const unsigned int end, - const DoFInfo & dof_info, - std::vector &mutexes, - std::vector & row_lengths) + compute_row_lengths(const unsigned int begin, + const unsigned int end, + const DoFInfo & dof_info, + std::vector & mutexes, + std::vector &row_lengths) { std::vector scratch; const unsigned int n_components = dof_info.start_components.back(); @@ -1485,7 +1485,7 @@ namespace internal const unsigned int end, const DoFInfo & dof_info, const std::vector &row_lengths, - std::vector & mutexes, + std::vector & mutexes, dealii::SparsityPattern & connectivity_dof) { std::vector scratch; @@ -1568,9 +1568,9 @@ namespace internal ++n_rows; // first determine row lengths - std::vector row_lengths(n_rows); - std::vector mutexes( - n_rows / internal::bucket_size_threading + 1); + std::vector row_lengths(n_rows); + std::vector mutexes(n_rows / internal::bucket_size_threading + + 1); parallel::apply_to_subranges(0, task_info.n_active_cells, [this, -- 2.39.5