µ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++ 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#ifndef CMSIS_PLUS_RTOS_OS_EVFLAGS_H_
14#define CMSIS_PLUS_RTOS_OS_EVFLAGS_H_
15
16// ----------------------------------------------------------------------------
17
18#if defined(__cplusplus)
19
20// ----------------------------------------------------------------------------
21
22#if defined(OS_USE_OS_APP_CONFIG_H)
23#include <cmsis-plus/os-app-config.h>
24#endif
25
28
29// ----------------------------------------------------------------------------
30
31#pragma GCC diagnostic push
32#if defined(__clang__)
33#pragma clang diagnostic ignored "-Wc++98-compat"
34#endif
35
36// ----------------------------------------------------------------------------
37
38namespace os
39{
40 namespace rtos
41 {
42
43 // ========================================================================
44
45#pragma GCC diagnostic push
46#if defined(__clang__)
47#pragma clang diagnostic ignored "-Wpadded"
48#elif defined(__GNUC__)
49#pragma GCC diagnostic ignored "-Wpadded"
50#endif
51
58 {
59 public:
60
61 // ======================================================================
62
69 {
70 public:
71
82 constexpr
83 attributes ();
84
85 // The rule of five.
86 attributes (const attributes&) = default;
87 attributes (attributes&&) = default;
89 operator= (const attributes&) = default;
91 operator= (attributes&&) = default;
92
96 ~attributes () = default;
97
102 public:
103
109 // Public members; no accessors and mutators required.
110 // Warning: must match the type & order of the C file header.
111 // Add more attributes here.
116 }; /* class attributes */
117
123
133 event_flags (const attributes& attr = initializer);
134
140 event_flags (const char* name, const attributes& attr = initializer);
141
146 // The rule of five.
147 event_flags (const event_flags&) = delete;
148 event_flags (event_flags&&) = delete;
150 operator= (const event_flags&) = delete;
152 operator= (event_flags&&) = delete;
153
161 ~event_flags ();
162
178 bool
179 operator== (const event_flags& rhs) const;
180
185 public:
186
207 wait (flags::mask_t mask, flags::mask_t* oflags,
209
224 try_wait (flags::mask_t mask, flags::mask_t* oflags = nullptr,
226
246 flags::mask_t* oflags = nullptr,
248
259 raise (flags::mask_t mask, flags::mask_t* oflags = nullptr);
260
270 clear (flags::mask_t mask, flags::mask_t* oflags = nullptr);
271
281
289 bool
290 waiting (void);
291
296 protected:
297
307#if !defined(OS_USE_RTOS_PORT_EVENT_FLAGS)
309 clock* clock_;
310#endif
311
312#if defined(OS_USE_RTOS_PORT_EVENT_FLAGS)
313 friend class port::event_flags;
314 os_evflags_port_data_t port_;
315#endif
316
320 internal::event_flags event_flags_;
321
330 };
331
332#pragma GCC diagnostic pop
333
334 } /* namespace rtos */
335} /* namespace os */
336
337// ===== Inline & template implementations ====================================
338
339namespace os
340{
341 namespace rtos
342 {
343 constexpr
345 {
346 }
347
348 } /* namespace rtos */
349} /* namespace os */
350
351#pragma GCC diagnostic pop
352
353// ----------------------------------------------------------------------------
354
355#endif /* __cplusplus */
356
357// ----------------------------------------------------------------------------
358
359#endif /* CMSIS_PLUS_RTOS_OS_EVFLAGS_H_ */
Generic clock.
Definition os-clocks.h:59
Event flags attributes.
Definition os-evflags.h:69
constexpr attributes()
Construct an event flags attributes object instance.
Definition os-evflags.h:344
~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:58
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:563
Internal event flags implementation.
Definition os-flags.h:48
Base class for named system objects.
Definition os-decls.h:445
const char * name(void) const
Get object name.
Definition os-decls.h:759
Priority ordered list of threads.
Definition os-lists.h:550
port::clock::duration_t duration_t
Type of variables holding clock durations.
Definition os-clocks.h:76
static const attributes initializer
Default event flags initialiser.
Definition os-evflags.h:122
@ all
Return when all flags are set.
Definition os-decls.h:293
@ clear
Ask for flags to be cleared after read.
Definition os-decls.h:303
uint32_t mode_t
Type of variables holding flags modes.
Definition os-decls.h:275
uint32_t mask_t
Type of variables holding flags masks.
Definition os-decls.h:265
uint32_t result_t
Type of values returned by RTOS functions.
Definition os-decls.h:96
System namespace.