Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
mutex.hpp
Go to the documentation of this file.
1
// Copyright 2026, Toyota Motor Corporation
2
//
3
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4
5
///
6
/// @file mutex.hpp
7
/// @brief Exports either a TSA annotated wrapper or a simple alias of std::mutex as needed.
8
///
9
10
#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_MUTEX_MUTEX_HPP_
11
#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_MUTEX_MUTEX_HPP_
12
13
// IWYU pragma: private, include "arene/base/mutex.hpp"
14
// IWYU pragma: friend "(arene/base(?!/tests)|stdlib/include/stdlib_detail)/.*"
15
16
// parasoft-begin-suppress AUTOSAR-A16_2_2-a-2 "Arene Base aggregate headers permitted by A16-2-2 Permit #1"
17
18
#include "
arene/base/compiler_support/platform_queries.hpp
"
19
#include "
arene/base/compiler_support/preprocessor.hpp
"
20
21
#if ARENE_IS_ON(ARENE_HAS_THREAD_SAFETY_ANALYSIS) && ARENE_IS_OFF(ARENE_STDLIB_LIBCXX)
22
#include "arene/base/mutex/detail/mutex.hpp"
23
#else
24
#include "arene/base/mutex/detail/only_aliases.hpp"
25
#endif
26
27
// parasoft-end-suppress AUTOSAR-A16_2_2-a-2
28
29
namespace
arene
{
30
namespace
base
{
31
32
///
33
/// @brief A mutex suitable for use with clang's Thread Safety Analysis. Equivalent to @c std::mutex.
34
///
35
/// If Thread Safety Analysis is not supported by the current compiler, or the current stdlib already has a TSA
36
/// annotated @c std::mutex, then this is a simple alias to @c std::mutex. Otherwise it is a thin wrapper
37
/// around @c std::mutex which annotates it as a _capability_, but is otherwise identical to @c std::mutex.
38
///
39
/// @note The support for Thread Safety Analysis is detected by the @c ARENE_HAS_THREAD_SAFETY_ANALYSIS platform query.
40
/// @note Currently, only libcxx has an out of the box annotated implementation. Detection is done via the
41
/// @c ARENE_STDLIB_LIBCXX platform query.
42
using
mutex
= mutex_detail::selected_mutex;
43
44
}
// namespace base
45
}
// namespace arene
46
47
#endif
// INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_MUTEX_MUTEX_HPP_
arene::base
Definition
accumulate.hpp:37
arene::base::mutex
mutex_detail::selected_mutex mutex
A mutex suitable for use with clang's Thread Safety Analysis. Equivalent to std::mutex.
Definition
mutex.hpp:42
arene
Definition
accumulate.hpp:36
platform_queries.hpp
preprocessor.hpp
arene
base
mutex
mutex.hpp
Generated by
1.13.2