µ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-evflags.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#ifndef CMSIS_PLUS_RTOS_OS_EVFLAGS_H_
13#define CMSIS_PLUS_RTOS_OS_EVFLAGS_H_
14
15// ----------------------------------------------------------------------------
16
17#if defined(__cplusplus)
18
19// ----------------------------------------------------------------------------
20
21#if defined(OS_USE_OS_APP_CONFIG_H)
22#include <cmsis-plus/os-app-config.h>
23#endif
24
27
28// ----------------------------------------------------------------------------
29
30#pragma GCC diagnostic push
31#if defined(__clang__)
32#pragma clang diagnostic ignored "-Wc++98-compat"
33#endif
34
35// ----------------------------------------------------------------------------
36
37namespace os
38{
39 namespace rtos
40 {
41
42 // ========================================================================
43
44#pragma GCC diagnostic push
45#if defined(__clang__)
46#pragma clang diagnostic ignored "-Wpadded"
47#elif defined(__GNUC__)
48#pragma GCC diagnostic ignored "-Wpadded"
49#endif
50
57 {
58 public:
59 // ======================================================================
60
67 {
68 public:
79 constexpr attributes ();
80
81 // The rule of five.
82 attributes (const attributes&) = default;
83 attributes (attributes&&) = default;
86 = default;
89 = default;
90
94 ~attributes () = default;
95
100 public:
106 // Public members; no accessors and mutators required.
107 // Warning: must match the type & order of the C file header.
108 // Add more attributes here.
113 }; /* class attributes */
114
120
130 event_flags (const attributes& attr = initializer);
131
137 event_flags (const char* name, const attributes& attr = initializer);
138
143 // The rule of five.
144 event_flags (const event_flags&) = delete;
145 event_flags (event_flags&&) = delete;
147 operator= (const event_flags&)
148 = delete;
150 operator= (event_flags&&)
151 = delete;
152
160 ~event_flags ();
161
177 bool
178 operator== (const event_flags& rhs) const;
179
184 public:
205 wait (flags::mask_t mask, flags::mask_t* oflags,
207
222 try_wait (flags::mask_t mask, flags::mask_t* oflags = nullptr,
224
244 flags::mask_t* oflags = nullptr,
246
257 raise (flags::mask_t mask, flags::mask_t* oflags = nullptr);
258
268 clear (flags::mask_t mask, flags::mask_t* oflags = nullptr);
269
279
287 bool
288 waiting (void);
289
294 protected:
304#if !defined(OS_USE_RTOS_PORT_EVENT_FLAGS)
306 clock* clock_;
307#endif
308
309#if defined(OS_USE_RTOS_PORT_EVENT_FLAGS)
310 friend class port::event_flags;
311 os_evflags_port_data_t port_;
312#endif
313
317 internal::event_flags event_flags_;
318
326 };
327
328#pragma GCC diagnostic pop
329
330 } /* namespace rtos */
331} /* namespace os */
332
333// ===== Inline & template implementations ====================================
334
335namespace os
336{
337 namespace rtos
338 {
340 {
341 }
342
343 } /* namespace rtos */
344} /* namespace os */
345
346#pragma GCC diagnostic pop
347
348// ----------------------------------------------------------------------------
349
350#endif /* __cplusplus */
351
352// ----------------------------------------------------------------------------
353
354#endif /* CMSIS_PLUS_RTOS_OS_EVFLAGS_H_ */
Generic clock.
Definition os-clocks.h:61
Event flags attributes.
Definition os-evflags.h:67
constexpr attributes()
Construct an event flags attributes object instance.
Definition os-evflags.h:339
~attributes()=default
Destruct the event flags attributes object instance.
attributes(attributes &&)=default
attributes & operator=(const attributes &)=default
attributes(const attributes &)=default
Synchronised event flags.
Definition os-evflags.h:57
result_t wait(flags::mask_t mask, flags::mask_t *oflags, flags::mode_t mode=flags::mode::all|flags::mode::clear)
Wait for event flags.
result_t timed_wait(flags::mask_t mask, clock::duration_t timeout, flags::mask_t *oflags=nullptr, flags::mode_t mode=flags::mode::all|flags::mode::clear)
Timed wait for event flags.
~event_flags()
Destruct the event flags object instance.
bool waiting(void)
Check if there are threads waiting.
bool operator==(const event_flags &rhs) const
Compare event flags.
flags::mask_t get(flags::mask_t mask, flags::mode_t mode=flags::mode::clear)
Get (and possibly clear) event flags.
result_t try_wait(flags::mask_t mask, flags::mask_t *oflags=nullptr, flags::mode_t mode=flags::mode::all|flags::mode::clear)
Try to wait for event flags.
result_t raise(flags::mask_t mask, flags::mask_t *oflags=nullptr)
Raise event flags.
result_t clear(flags::mask_t mask, flags::mask_t *oflags=nullptr)
Clear event flags.
Base class for attributes.
Definition os-decls.h:559
Internal event flags implementation.
Definition os-flags.h:47
Base class for named system objects.
Definition os-decls.h:443
const char * name(void) const
Get object name.
Definition os-decls.h:753
Priority ordered list of threads.
Definition os-lists.h:543
port::clock::duration_t duration_t
Type of variables holding clock durations.
Definition os-clocks.h:78
static const attributes initializer
Default event flags initialiser.
Definition os-evflags.h:119
@ all
Return when all flags are set.
Definition os-decls.h:295
@ clear
Ask for flags to be cleared after read.
Definition os-decls.h:305
uint32_t mode_t
Type of variables holding flags modes.
Definition os-decls.h:277
uint32_t mask_t
Type of variables holding flags masks.
Definition os-decls.h:266
uint32_t result_t
Type of values returned by RTOS functions.
Definition os-decls.h:95
System namespace.