µ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 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#ifndef CMSIS_PLUS_RTOS_OS_EVFLAGS_H_
29#define CMSIS_PLUS_RTOS_OS_EVFLAGS_H_
30
31// ----------------------------------------------------------------------------
32
33#if defined(__cplusplus)
34
35// ----------------------------------------------------------------------------
36
39
40// ----------------------------------------------------------------------------
41
42#pragma GCC diagnostic push
43
44#if defined(__clang__)
45#pragma clang diagnostic ignored "-Wc++98-compat"
46#endif
47
48// ----------------------------------------------------------------------------
49
50namespace os
51{
52 namespace rtos
53 {
54
55 // ========================================================================
56
57#pragma GCC diagnostic push
58#pragma GCC diagnostic ignored "-Wpadded"
59
66 {
67 public:
68
69 // ======================================================================
70
77 {
78 public:
79
90 constexpr
91 attributes ();
92
93 // The rule of five.
94 attributes (const attributes&) = default;
95 attributes (attributes&&) = default;
97 operator= (const attributes&) = default;
99 operator= (attributes&&) = default;
100
104 ~attributes () = default;
105
110 public:
111
117 // Public members; no accessors and mutators required.
118 // Warning: must match the type & order of the C file header.
119 // Add more attributes here.
124 }; /* class attributes */
125
131
141 event_flags (const attributes& attr = initializer);
142
148 event_flags (const char* name, const attributes& attr = initializer);
149
154 // The rule of five.
155 event_flags (const event_flags&) = delete;
156 event_flags (event_flags&&) = delete;
158 operator= (const event_flags&) = delete;
160 operator= (event_flags&&) = delete;
161
169 ~event_flags ();
170
186 bool
187 operator== (const event_flags& rhs) const;
188
193 public:
194
215 wait (flags::mask_t mask, flags::mask_t* oflags,
217
232 try_wait (flags::mask_t mask, flags::mask_t* oflags = nullptr,
234
254 flags::mask_t* oflags = nullptr,
256
267 raise (flags::mask_t mask, flags::mask_t* oflags = nullptr);
268
278 clear (flags::mask_t mask, flags::mask_t* oflags = nullptr);
279
289
297 bool
298 waiting (void);
299
304 protected:
305
315#if !defined(OS_USE_RTOS_PORT_EVENT_FLAGS)
317 clock* clock_;
318#endif
319
320#if defined(OS_USE_RTOS_PORT_EVENT_FLAGS)
321 friend class port::event_flags;
322 os_evflags_port_data_t port_;
323#endif
324
328 internal::event_flags event_flags_;
329
338 };
339
340#pragma GCC diagnostic pop
341
342 } /* namespace rtos */
343} /* namespace os */
344
345// ===== Inline & template implementations ====================================
346
347namespace os
348{
349 namespace rtos
350 {
351 constexpr
353 {
354 ;
355 }
356
357 } /* namespace rtos */
358} /* namespace os */
359
360#pragma GCC diagnostic pop
361
362// ----------------------------------------------------------------------------
363
364#endif /* __cplusplus */
365
366// ----------------------------------------------------------------------------
367
368#endif /* CMSIS_PLUS_RTOS_OS_EVFLAGS_H_ */
Generic clock.
Definition os-clocks.h:66
Event flags attributes.
Definition os-evflags.h:77
constexpr attributes()
Construct an event flags attributes object instance.
Definition os-evflags.h:352
~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:66
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:577
Internal event flags implementation.
Definition os-flags.h:64
Base class for named system objects.
Definition os-decls.h:459
const char * name(void) const
Get object name.
Definition os-decls.h:774
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:83
static const attributes initializer
Default event flags initialiser.
Definition os-evflags.h:130
@ all
Return when all flags are set.
Definition os-decls.h:307
@ clear
Ask for flags to be cleared after read.
Definition os-decls.h:317
uint32_t mode_t
Type of variables holding flags modes.
Definition os-decls.h:289
uint32_t mask_t
Type of variables holding flags masks.
Definition os-decls.h:279
uint32_t result_t
Type of values returned by RTOS functions.
Definition os-decls.h:110
System namespace.