Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
timed_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 timed_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_TIMED_MUTEX_HPP_
11#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_MUTEX_TIMED_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/timed_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
29namespace arene {
30namespace base {
31
32///
33/// @brief A timed mutex suitable for use with clang's Thread Safety Analysis. Equivalent to @c std::timed_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::timed_mutex, then this is a simple alias to @c std::timed_mutex. Otherwise it is a thin wrapper
37/// around @c std::timed_mutex which annotates it as a _capability_, but is otherwise identical to @c std::timed_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.
43
44} // namespace base
45} // namespace arene
46
47#endif // INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_MUTEX_TIMED_MUTEX_HPP_
Definition array_exceptions_disabled.cpp:11
Copyright 2026, Toyota Motor Corporation.
Definition array_exceptions_disabled.cpp:10