]> https://gitweb.dealii.org/ - dealii.git/commitdiff
More fixes 7250/head
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Sat, 29 Sep 2018 06:07:43 +0000 (08:07 +0200)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Sat, 29 Sep 2018 06:07:43 +0000 (08:07 +0200)
include/deal.II/base/subscriptor.h
source/base/subscriptor.cc

index 9a44a0dae26cb796ff050c9a6c01348c46c0a39d..d1dbc9d074f303eadb0a4bd7bcaf1b6a2eedf19a 100644 (file)
 
 #include <atomic>
 #include <map>
+#include <mutex>
 #include <string>
 #include <typeinfo>
 
-#ifdef DEAL_II_WITH_THREADS
-#  include <mutex>
-#endif
-
 DEAL_II_NAMESPACE_OPEN
 
 /**
@@ -250,15 +247,11 @@ private:
   void
   check_no_subscribers() const noexcept;
 
-#ifdef DEAL_II_WITH_THREADS
-
   /**
    * A mutex used to ensure data consistency when printing out the list
    * of subscribers.
    */
   static std::mutex mutex;
-
-#endif
 };
 
 //---------------------------------------------------------------------------
@@ -275,9 +268,7 @@ template <typename StreamType>
 inline void
 Subscriptor::list_subscribers(StreamType &stream) const
 {
-#ifdef DEAL_II_WITH_THREADS
   std::lock_guard<std::mutex> lock(mutex);
-#endif
 
   for (map_iterator it = counter_map.begin(); it != counter_map.end(); ++it)
     stream << it->second << '/' << counter << " subscriptions from \""
index 57d0615c701a03fa4136eb4dcbf1766e8bdf5a25..5cef19f1b0c2165249061a0197215f45bf1a7120 100644 (file)
@@ -27,9 +27,7 @@ DEAL_II_NAMESPACE_OPEN
 static const char *unknown_subscriber = "unknown subscriber";
 
 
-#ifdef DEAL_II_WITH_THREADS
 std::mutex Subscriptor::mutex;
-#endif
 
 
 Subscriptor::Subscriptor()
@@ -156,9 +154,7 @@ Subscriptor::operator=(Subscriptor &&s) noexcept
 void
 Subscriptor::subscribe(const char *id) const
 {
-#ifdef DEAL_II_WITH_THREADS
   std::lock_guard<std::mutex> lock(mutex);
-#endif
 
   if (object_info == nullptr)
     object_info = &typeid(*this);
@@ -185,9 +181,7 @@ Subscriptor::unsubscribe(const char *id) const
   if (counter == 0)
     return;
 
-#ifdef DEAL_II_WITH_THREADS
   std::lock_guard<std::mutex> lock(mutex);
-#endif
 
   map_iterator it = counter_map.find(name);
   if (it == counter_map.end() || it->second == 0)

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.