From: Daniel Garcia-Sanchez Date: Fri, 10 Apr 2020 10:29:30 +0000 (+0200) Subject: Use #ifdef to guard std::async X-Git-Tag: v9.2.0-rc1~248^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=42780874e9e326a221c9477a20611187346c364a;p=dealii.git Use #ifdef to guard std::async --- diff --git a/examples/step-69/step-69.cc b/examples/step-69/step-69.cc index caa9eba2b8..8e9e27ec7a 100644 --- a/examples/step-69/step-69.cc +++ b/examples/step-69/step-69.cc @@ -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 {