roo_threads
API Documentation for roo_threads
Loading...
Searching...
No Matches
semaphore.h
Go to the documentation of this file.
1#pragma once
2
4
5#if (defined ROO_THREADS_USE_CPPSTD)
6
8
9namespace roo {
10
11/// @brief Counting semaphore type.
12/// @tparam LeastMaxValue minimum supported maximum counter value.
13template <std::ptrdiff_t LeastMaxValue>
14using counting_semaphore =
15 roo_threads::cppstd::counting_semaphore<LeastMaxValue>;
16
17/// @brief Binary semaphore type with capacity of one permit.
18using binary_semaphore = roo_threads::cppstd::binary_semaphore;
19
20} // namespace roo
21
22#elif (defined ROO_THREADS_USE_FREERTOS)
23
25
26namespace roo {
27
28/// @brief Counting semaphore type.
29/// @tparam LeastMaxValue minimum supported maximum counter value.
30template <std::ptrdiff_t LeastMaxValue>
31using counting_semaphore =
32 roo_threads::freertos::counting_semaphore<LeastMaxValue>;
33
34/// @brief Binary semaphore type with capacity of one permit.
35using binary_semaphore = roo_threads::freertos::binary_semaphore;
36
37} // namespace roo
38
39#elif (defined ROO_THREADS_USE_ROO_TESTING)
40
41#include "roo_threads/impl/roo_testing/semaphore.h"
42
43namespace roo {
44
45/// @brief Counting semaphore type.
46/// @tparam LeastMaxValue minimum supported maximum counter value.
47template <std::ptrdiff_t LeastMaxValue>
48using counting_semaphore =
49 roo_threads::roo_testing::counting_semaphore<LeastMaxValue>;
50
51/// @brief Binary semaphore type with capacity of one permit.
52using binary_semaphore = roo_threads::roo_testing::binary_semaphore;
53
54} // namespace roo
55
56#elif (defined ROO_THREADS_USE_SINGLETHREADED)
57
59
60namespace roo {
61
62/// @brief Counting semaphore type.
63/// @tparam LeastMaxValue minimum supported maximum counter value.
64template <std::ptrdiff_t LeastMaxValue>
65using counting_semaphore =
66 roo_threads::singlethreaded::counting_semaphore<LeastMaxValue>;
67
68/// @brief Binary semaphore type with capacity of one permit.
69using binary_semaphore = roo_threads::singlethreaded::binary_semaphore;
70
71} // namespace roo
72
73#endif
counting_semaphore< 1 > binary_semaphore
Semaphore with maximum count of one.
Definition latch.h:6