AnCH Framework 0.2
Another C++ Hack: C++23 utility libraries
Loading...
Searching...
No Matches
threadErrors.hpp
1/*
2 ANCH Framework: ANother C++ Hack is a C++ framework based on C++23 standard
3 Copyright (C) 2026 Vincent Lachenal
4
5 This file is part of ANCH Framework.
6
7 ANCH Framework is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 ANCH Framework is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with ANCH Framework. If not, see <https://www.gnu.org/licenses/>.
19*/
20#pragma once
21
22#include "anch-ut-export.hpp"
23
24#include <exception>
25#include <mutex>
26
27namespace anch::ut {
28
43 class ANCH_UT_EXPORT ThreadErrors {
44
45 // Attributes +
46 private:
48 std::mutex _mutex;
49
51 std::exception_ptr _error;
52 // Attributes -
53
54 // Constructors +
55 public:
59 ThreadErrors() = default;
60
64 ThreadErrors(const ThreadErrors&) = delete;
65
70 // Constructors -
71
72 // Methods +
73 public:
83 template<typename F>
84 auto wrap(F&& func);
85
90 void capture() noexcept;
91
97 bool failed();
98
104 void rethrow();
105 // Methods -
106
107 };
108
109} // anch::ut
110
111#include "ut/impl/threadErrors.hpp"
void capture() noexcept
auto wrap(F &&func)
ThreadErrors(const ThreadErrors &)=delete
ThreadErrors(ThreadErrors &&)=delete
AnCH unit tests library namespace.
Definition assert.hpp:37