µ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 Liviu Ionescu.
5 *
6 * Permission is hereby granted, free of charge, to any person
7 * obtaining a copy of this software and associated documentation
8 * files (the "Software"), to deal in the Software without
9 * restriction, including without limitation the rights to use,
10 * copy, modify, merge, publish, distribute, sublicense, and/or
11 * sell copies of the Software, and to permit persons to whom
12 * the Software is furnished to do so, subject to the following
13 * conditions:
14 *
15 * The above copyright notice and this permission notice shall be
16 * included in all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 * OTHER DEALINGS IN THE SOFTWARE.
26 */
27
28/*
29 * The initial µOS++ RTOS API was inspired by CMSIS RTOS API v1.x,
30 * Copyright (c) 2013 ARM LIMITED.
31 */
32
66/*
67 * TODO:
68 * - make Thread virtual, to allow create_hook/delete_hook functionality
69 * - make most classes virtual, to allow post_hook functionality
70 * - event timestamps: add derived classes that capture the event timestamp
71 * - add object type in base class
72 * - add Wait_list in base class
73 *
74 * Notes:
75 * - the try_wait(), try_flags_wait() names are probably not very inspired,
76 * but at least they are consistent in POSIX.
77 */
78
79#ifndef CMSIS_PLUS_RTOS_OS_H_
80#define CMSIS_PLUS_RTOS_OS_H_
81
82// ----------------------------------------------------------------------------
83
84#if defined(__cplusplus)
85
87
89
90// Includes a reference to critical sections.
92
102
104
105// More or less at the end, when all other definitions are available.
107#include <cmsis-plus/rtos/port/os-inlines.h>
108
109// ----------------------------------------------------------------------------
110
111#pragma GCC diagnostic push
112
113#if defined(__clang__)
114#pragma clang diagnostic ignored "-Wc++98-compat"
115#endif
116
117// ----------------------------------------------------------------------------
118
119namespace os
120{
121 namespace rtos
122 {
123 namespace scheduler
124 {
132 extern thread::threads_list top_threads_list_;
133
143 thread::threads_list&
145
146 } /* namespace scheduler */
147
148 // ------------------------------------------------------------------------
149
150 namespace interrupts
151 {
152#if defined(OS_HAS_INTERRUPTS_STACK) || defined(__DOXYGEN__)
153
161 class thread::stack*
162 stack (void);
163
164#else
165#endif /* defined(OS_HAS_INTERRUPTS_STACK) */
166
167 } /* namespace interrupts */
168
169 // ------------------------------------------------------------------------
179 template<typename T, typename ... Args>
180 inline typename std::enable_if<!std::is_array<T>::value,
181 std::shared_ptr<T> >::type
182 make_shared (Args&&... args)
183 {
184 // -Wno-psabi to disble the ABI warning.
185 typedef typename std::remove_const<T>::type T_nc;
186 return std::allocate_shared<T> (memory::allocator<T_nc> (),
187 std::forward<Args>(args)...);
188 }
189
190 } /* namespace rtos */
191} /* namespace os */
192
193#pragma GCC diagnostic pop
194
195// ----------------------------------------------------------------------------
196
197#endif /* __cplusplus */
198
199// ----------------------------------------------------------------------------
200
201#endif /* CMSIS_PLUS_RTOS_OS_H_ */
Standard allocator based on the RTOS system default memory manager.
Definition os-memory.h:544
Standard thread.
class thread::stack * stack(void)
Get the interrupts stack.
Definition os-core.cpp:564
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:182
thread::threads_list & children_threads(thread *th)
Get the children threads.
Definition os-core.cpp:262
System namespace.