]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use TaskResult::empty().
authorWolfgang Bangerth <bangerth@colostate.edu>
Sun, 21 Jul 2024 23:23:37 +0000 (17:23 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Tue, 23 Jul 2024 03:39:10 +0000 (21:39 -0600)
include/deal.II/base/task_result.h

index abbc6f8ade19ddf995cdde1dc76fd842f333423b..52fc11edc872abd7bef0eff1d0824e685b8b739d 100644 (file)
@@ -483,6 +483,10 @@ namespace Threads
   inline void
   TaskResult<T>::join() const
   {
+    Assert(empty() == false,
+           ExcMessage("You can't join a TaskResult object that has not "
+                      "been associated with a task."));
+
     // If we have waited before, then return immediately:
     if (result_is_available)
       return;
@@ -546,6 +550,11 @@ namespace Threads
   inline const T &
   TaskResult<T>::value() const
   {
+    Assert(empty() == false,
+           ExcMessage(
+             "You can't ask for the result of a TaskResult object that "
+             "has not been associated with a task."));
+
     if (!result_is_available)
       join();
     return task_result.value();

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.