µ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++ 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_CONDVAR_H_
13#define CMSIS_PLUS_RTOS_OS_CONDVAR_H_
14
15// ----------------------------------------------------------------------------
16
17#if defined(__cplusplus)
18
19// ----------------------------------------------------------------------------
20
22
23// ----------------------------------------------------------------------------
24
25#pragma GCC diagnostic push
26#if defined(__clang__)
27#pragma clang diagnostic ignored "-Wc++98-compat"
28#endif
29
30// ----------------------------------------------------------------------------
31
32namespace os
33{
34 namespace rtos
35 {
36
37 // ========================================================================
38
45 {
46 public:
47 // ======================================================================
48
55 {
56 public:
67 constexpr attributes ();
68
69 // The rule of five.
70 attributes (const attributes&) = default;
71 attributes (attributes&&) = default;
74 = default;
77 = default;
78
82 ~attributes () = default;
83
88 public:
94 // Public members; no accessors and mutators required.
95 // Warning: must match the type & order of the C file header.
96 // Add more attributes here.
101 }; /* class attributes */
102
108
109 // ======================================================================
110
129
144 const attributes& attr = initializer);
145
150 // The rule of five.
151 condition_variable (const condition_variable&) = delete;
154 operator= (const condition_variable&)
155 = delete;
157 operator= (condition_variable&&)
158 = delete;
159
168
184 bool
185 operator== (const condition_variable& rhs) const;
186
191 public:
207 signal (void);
208
219 broadcast (void);
220
240
241 // Neither POSIX nor ISO define a try_wait(), it makes no sense.
242
264
269 protected:
279#if !defined(OS_USE_RTOS_PORT_CONDITION_VARIABLE)
281 // clock& clock_;
282#endif
283
288 // Add more internal data.
292 };
293
294 } /* namespace rtos */
295} /* namespace os */
296
297// ===== Inline & template implementations ====================================
298
299namespace os
300{
301 namespace rtos
302 {
304 {
305 }
306
307 // ========================================================================
308
313 inline bool
315 {
316 return this == &rhs;
317 }
318
319 } /* namespace rtos */
320} /* namespace os */
321
322#pragma GCC diagnostic pop
323
324// ----------------------------------------------------------------------------
325
326#endif /* __cplusplus */
327
328// ----------------------------------------------------------------------------
329
330#endif /* CMSIS_PLUS_RTOS_OS_CONDVAR_H_ */
Condition variable attributes.
Definition os-condvar.h:55
~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:303
attributes & operator=(const attributes &)=default
POSIX compliant condition variable.
Definition os-condvar.h:45
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:314
~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:559
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
POSIX compliant mutex.
Definition os-mutex.h:52
port::clock::duration_t duration_t
Type of variables holding clock durations.
Definition os-clocks.h:78
static const attributes initializer
Default condition variable initialiser.
Definition os-condvar.h:107
uint32_t result_t
Type of values returned by RTOS functions.
Definition os-decls.h:95
System namespace.