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