µ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-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_CONDVAR_H_
14#define CMSIS_PLUS_RTOS_OS_CONDVAR_H_
15
16// ----------------------------------------------------------------------------
17
18#if defined(__cplusplus)
19
20// ----------------------------------------------------------------------------
21
23
24// ----------------------------------------------------------------------------
25
26#pragma GCC diagnostic push
27#if defined(__clang__)
28#pragma clang diagnostic ignored "-Wc++98-compat"
29#endif
30
31// ----------------------------------------------------------------------------
32
33namespace os
34{
35 namespace rtos
36 {
37
38 // ========================================================================
39
46 {
47 public:
48
49 // ======================================================================
50
57 {
58 public:
59
70 constexpr
71 attributes ();
72
73 // The rule of five.
74 attributes (const attributes&) = default;
75 attributes (attributes&&) = default;
77 operator= (const attributes&) = default;
79 operator= (attributes&&) = default;
80
84 ~attributes () = default;
85
90 public:
91
97 // Public members; no accessors and mutators required.
98 // Warning: must match the type & order of the C file header.
99 // Add more attributes here.
104 }; /* class attributes */
105
111
112 // ======================================================================
113
132
147 const attributes& attr = initializer);
148
153 // The rule of five.
154 condition_variable (const condition_variable&) = delete;
157 operator= (const condition_variable&) = delete;
159 operator= (condition_variable&&) = delete;
160
169
185 bool
186 operator== (const condition_variable& rhs) const;
187
192 public:
193
209 signal (void);
210
221 broadcast (void);
222
242
243 // Neither POSIX nor ISO define a try_wait(), it makes no sense.
244
266
271 protected:
272
282#if !defined(OS_USE_RTOS_PORT_CONDITION_VARIABLE)
284 // clock& clock_;
285#endif
286
291 // Add more internal data.
296 };
297
298 } /* namespace rtos */
299} /* namespace os */
300
301// ===== Inline & template implementations ====================================
302
303namespace os
304{
305 namespace rtos
306 {
307 constexpr
309 {
310 }
311
312 // ========================================================================
313
318 inline bool
320 {
321 return this == &rhs;
322 }
323
324 } /* namespace rtos */
325} /* namespace os */
326
327#pragma GCC diagnostic pop
328
329// ----------------------------------------------------------------------------
330
331#endif /* __cplusplus */
332
333// ----------------------------------------------------------------------------
334
335#endif /* CMSIS_PLUS_RTOS_OS_CONDVAR_H_ */
Condition variable attributes.
Definition os-condvar.h:57
~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:308
attributes & operator=(const attributes &)=default
POSIX compliant condition variable.
Definition os-condvar.h:46
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:319
~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:563
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
POSIX compliant mutex.
Definition os-mutex.h:53
port::clock::duration_t duration_t
Type of variables holding clock durations.
Definition os-clocks.h:76
static const attributes initializer
Default condition variable initialiser.
Definition os-condvar.h:110
uint32_t result_t
Type of values returned by RTOS functions.
Definition os-decls.h:96
System namespace.