From: Wolfgang Bangerth Date: Sun, 21 Jul 2024 23:23:37 +0000 (-0600) Subject: Use TaskResult::empty(). X-Git-Tag: v9.6.0-rc1~11^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=77c481f1bef45ae9bd70312b542843f5faff5c0d;p=dealii.git Use TaskResult::empty(). --- 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();