µ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-condvar.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_CONDVAR_H_
29#define CMSIS_PLUS_RTOS_OS_CONDVAR_H_
30
31// ----------------------------------------------------------------------------
32
33#if defined(__cplusplus)
34
35// ----------------------------------------------------------------------------
36
38
39// ----------------------------------------------------------------------------
40
41#pragma GCC diagnostic push
42
43#if defined(__clang__)
44#pragma clang diagnostic ignored "-Wc++98-compat"
45#endif
46
47// ----------------------------------------------------------------------------
48
49namespace os
50{
51 namespace rtos
52 {
53
54 // ========================================================================
55
62 {
63 public:
64
65 // ======================================================================
66
73 {
74 public:
75
86 constexpr
87 attributes ();
88
89 // The rule of five.
90 attributes (const attributes&) = default;
91 attributes (attributes&&) = default;
93 operator= (const attributes&) = default;
95 operator= (attributes&&) = default;
96
100 ~attributes () = default;
101
106 public:
107
113 // Public members; no accessors and mutators required.
114 // Warning: must match the type & order of the C file header.
115 // Add more attributes here.
120 }; /* class attributes */
121
127
128 // ======================================================================
129
148
163 const attributes& attr = initializer);
164
169 // The rule of five.
170 condition_variable (const condition_variable&) = delete;
173 operator= (const condition_variable&) = delete;
175 operator= (condition_variable&&) = delete;
176
185
201 bool
202 operator== (const condition_variable& rhs) const;
203
208 public:
209
225 signal (void);
226
237 broadcast (void);
238
258
259 // Neither POSIX nor ISO define a try_wait(), it makes no sense.
260
282
287 protected:
288
298#if !defined(OS_USE_RTOS_PORT_CONDITION_VARIABLE)
300 // clock& clock_;
301#endif
302
307 // Add more internal data.
312 };
313
314 } /* namespace rtos */
315} /* namespace os */
316
317// ===== Inline & template implementations ====================================
318
319namespace os
320{
321 namespace rtos
322 {
323 constexpr
325 {
326 ;
327 }
328
329 // ========================================================================
330
335 inline bool
337 {
338 return this == &rhs;
339 }
340
341 } /* namespace rtos */
342} /* namespace os */
343
344#pragma GCC diagnostic pop
345
346// ----------------------------------------------------------------------------
347
348#endif /* __cplusplus */
349
350// ----------------------------------------------------------------------------
351
352#endif /* CMSIS_PLUS_RTOS_OS_CONDVAR_H_ */
Condition variable attributes.
Definition os-condvar.h:73
~attributes()=default
Destruct the condition variable attributes object instance.
attributes(const attributes &)=default
constexpr attributes()
Construct a condition variable attributes object instance.
Definition os-condvar.h:324
attributes & operator=(const attributes &)=default
POSIX compliant condition variable.
Definition os-condvar.h:62
result_t signal(void)
Notify one thread waiting for a condition variable.
result_t broadcast(void)
Notify all threads waiting for a condition variable.
result_t wait(mutex &mutex)
Wait for a condition variable to be notified.
bool operator==(const condition_variable &rhs) const
Compare condition variables.
Definition os-condvar.h:336
~condition_variable()
Destruct the condition variable object instance.
result_t timed_wait(mutex &mutex, clock::duration_t timeout)
Timed wait for a condition variable to be notified.
condition_variable(const char *name, const attributes &attr=initializer)
Construct a named condition variable object instance.
Base class for attributes.
Definition os-decls.h:577
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
POSIX compliant mutex.
Definition os-mutex.h:65
port::clock::duration_t duration_t
Type of variables holding clock durations.
Definition os-clocks.h:83
static const attributes initializer
Default condition variable initialiser.
Definition os-condvar.h:126
uint32_t result_t
Type of values returned by RTOS functions.
Definition os-decls.h:110
System namespace.