]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use #ifdef to guard std::async
authorDaniel Garcia-Sanchez <daniel.garcia-sanchez@insp.upmc.fr>
Fri, 10 Apr 2020 10:29:30 +0000 (12:29 +0200)
committerDaniel Garcia-Sanchez <daniel.garcia-sanchez@insp.upmc.fr>
Fri, 10 Apr 2020 10:29:30 +0000 (12:29 +0200)
examples/step-69/step-69.cc

index caa9eba2b89f7501ecaeeb3405f3b541c56f5c58..8e9e27ec7af864aa0e97a50c0c01a8b652c03fda 100644 (file)
@@ -2509,7 +2509,11 @@ namespace Step69
                   output_granularity,
                   "time interval for output");
 
+#ifdef DEAL_II_WITH_THREADS
     asynchronous_writeback = true;
+#else
+    asynchronous_writeback = false;
+#endif
     add_parameter("asynchronous writeback",
                   asynchronous_writeback,
                   "Write out solution in a background thread performing IO");
@@ -2865,7 +2869,15 @@ namespace Step69
     // run in the background.
     if (!asynchronous_writeback)
       {
+#ifdef DEAL_II_WITH_THREADS
         background_thread_state = std::async(std::launch::async, output_worker);
+#else
+        AssertThrow(
+          false,
+          ExcMessage(
+            "\"asynchronous_writeback\" was set to true but deal.II was built "
+            "without thread support (\"DEAL_II_WITH_THREADS=false\")."));
+#endif
       }
     else
       {

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.