µOS++ IIIe Reference 7.0.0
The third edition of µOS++, a POSIX inspired open source framework, written in C++
Loading...
Searching...
No Matches
os.h
Go to the documentation of this file.
1/*
2 * This file is part of the µOS++ distribution.
3 * (https://github.com/micro-os-plus)
4 * Copyright (c) 2016-2023 Liviu Ionescu. All rights reserved.
5 *
6 * Permission to use, copy, modify, and/or distribute this software
7 * for any purpose is hereby granted, under the terms of the MIT license.
8 *
9 * If a copy of the license was not distributed with this file, it can
10 * be obtained from https://opensource.org/licenses/mit/.
11 */
12
13/*
14 * The initial µOS++ RTOS API was inspired by CMSIS RTOS API v1.x,
15 * Copyright (c) 2013 ARM LIMITED.
16 */
17
51/*
52 * TODO:
53 * - make Thread virtual, to allow create_hook/delete_hook functionality
54 * - make most classes virtual, to allow post_hook functionality
55 * - event timestamps: add derived classes that capture the event timestamp
56 * - add object type in base class
57 * - add Wait_list in base class
58 *
59 * Notes:
60 * - the try_wait(), try_flags_wait() names are probably not very inspired,
61 * but at least they are consistent in POSIX.
62 */
63
64#ifndef CMSIS_PLUS_RTOS_OS_H_
65#define CMSIS_PLUS_RTOS_OS_H_
66
67// ----------------------------------------------------------------------------
68
69#if defined(__cplusplus)
70
71#if defined(OS_USE_OS_APP_CONFIG_H)
72#include <cmsis-plus/os-app-config.h>
73#endif
74
76
78
79// Includes a reference to critical sections.
81
91
93
94// More or less at the end, when all other definitions are available.
96#include <cmsis-plus/rtos/port/os-inlines.h>
97
98// ----------------------------------------------------------------------------
99
100#pragma GCC diagnostic push
101#if defined(__clang__)
102#pragma clang diagnostic ignored "-Wc++98-compat"
103#endif
104
105// ----------------------------------------------------------------------------
106
107namespace os
108{
109 namespace rtos
110 {
111 namespace scheduler
112 {
120 extern thread::threads_list top_threads_list_;
121
131 thread::threads_list&
133
134 } /* namespace scheduler */
135
136 // ------------------------------------------------------------------------
137
138 namespace interrupts
139 {
140#if defined(OS_HAS_INTERRUPTS_STACK) || defined(__DOXYGEN__)
141
149 class thread::stack*
150 stack (void);
151
152#else
153#endif /* defined(OS_HAS_INTERRUPTS_STACK) */
154
155 } /* namespace interrupts */
156
157#pragma GCC diagnostic push
158#if defined(__clang__)
159#elif defined(__GNUC__)
160#pragma GCC diagnostic ignored "-Waggregate-return"
161#endif
162
163 // ------------------------------------------------------------------------
173 template<typename T, typename ... Args>
174 inline typename std::enable_if<!std::is_array<T>::value,
175 std::shared_ptr<T> >::type
176 make_shared (Args&&... args)
177 {
178 // -Wno-psabi to disble the ABI warning.
179 typedef typename std::remove_const<T>::type T_nc;
180 return std::allocate_shared<T> (memory::allocator<T_nc> (),
181 std::forward<Args>(args)...);
182 }
183
184#pragma GCC diagnostic pop
185
186 } /* namespace rtos */
187} /* namespace os */
188
189#pragma GCC diagnostic pop
190
191// ----------------------------------------------------------------------------
192
193#endif /* __cplusplus */
194
196
197// ----------------------------------------------------------------------------
198
199#endif /* CMSIS_PLUS_RTOS_OS_H_ */
Standard allocator based on the RTOS system default memory manager.
Definition os-memory.h:540
Standard thread.
class thread::stack * stack(void)
Get the interrupts stack.
Definition os-core.cpp:571
std::enable_if<!std::is_array< T >::value, std::shared_ptr< T > >::type make_shared(Args &&... args)
Create an object that is owned by a shared_ptr and is allocated using the RTOS system allocator.
Definition os.h:176
thread::threads_list & children_threads(thread *th)
Get the children threads.
Definition os-core.cpp:261
System namespace.