From 42780874e9e326a221c9477a20611187346c364a Mon Sep 17 00:00:00 2001 From: Daniel Garcia-Sanchez Date: Fri, 10 Apr 2020 12:29:30 +0200 Subject: [PATCH] Use #ifdef to guard std::async --- examples/step-69/step-69.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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 { -- 2.39.5