From 77c481f1bef45ae9bd70312b542843f5faff5c0d Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Sun, 21 Jul 2024 17:23:37 -0600 Subject: [PATCH] Use TaskResult::empty(). --- include/deal.II/base/task_result.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/deal.II/base/task_result.h b/include/deal.II/base/task_result.h index abbc6f8ade..52fc11edc8 100644 --- a/include/deal.II/base/task_result.h +++ b/include/deal.II/base/task_result.h @@ -483,6 +483,10 @@ namespace Threads inline void TaskResult::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::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(); -- 2.39.5