blob: a4bd165996780a9a33bdf78432c4d7e69e2fb430 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
// Copyright Catch2 Authors
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE.txt or copy at
// https://www.boost.org/LICENSE_1_0.txt)
// SPDX-License-Identifier: BSL-1.0
#pragma once
#include <Progmasoft/Catch3/UserConfig.hpp>
#if defined( CATCH_CONFIG_THREAD_SAFE_ASSERTIONS )
# include <atomic>
# include <mutex>
#endif
#include <Progmasoft/Catch3/Totals.hpp>
namespace Catch {
namespace Detail {
#if defined( CATCH_CONFIG_THREAD_SAFE_ASSERTIONS )
using Mutex = std::mutex;
using LockGuard = std::lock_guard<std::mutex>;
struct AtomicCounts {
std::atomic<std::uint64_t> passed{ 0 };
std::atomic<std::uint64_t> failed{ 0 };
std::atomic<std::uint64_t> failedButOk{ 0 };
std::atomic<std::uint64_t> skipped{ 0 };
};
#else // ^^ Use actual mutex, lock and atomics
// vv Dummy implementations for single-thread performance
struct Mutex {
void lock() {}
void unlock() {}
};
struct LockGuard {
LockGuard( Mutex ) {}
};
using AtomicCounts = Counts;
#endif
} // namespace Detail
} // namespace Catch
|