Mark3 Realtime Kernel
condvar.h
Go to the documentation of this file.
1 /*===========================================================================
2  _____ _____ _____ _____
3  ___| _|__ __|_ |__ __|__ |__ __| __ |__ ______
4 | \ / | || \ || | || |/ / ||___ |
5 | \/ | || \ || \ || \ ||___ |
6 |__/\__/|__|_||__|\__\ __||__|\__\ __||__|\__\ __||______|
7  |_____| |_____| |_____| |_____|
8 
9 --[Mark3 Realtime Platform]--------------------------------------------------
10 
11 Copyright (c) 2012 - 2019 m0slevin, all rights reserved.
12 See license.txt for more information
13 ===========================================================================*/
19 #pragma once
20 
21 #include "mark3cfg.h"
22 #include "ksemaphore.h"
23 #include "mutex.h"
24 
25 #include <stddef.h>
26 
27 namespace Mark3
28 {
40 {
41 public:
42  void* operator new(size_t sz, void* pv) { return reinterpret_cast<ConditionVariable*>(pv); }
43 
49  void Init();
50 
57  void Wait(Mutex* pclMutex_);
58 
67  bool Wait(Mutex* pclMutex_, uint32_t u32WaitTimeMS_);
68 
73  void Signal();
74 
79  void Broadcast();
80 
81 private:
84  uint8_t m_u8Waiters;
85 };
86 } // namespace Mark3
Semaphore Blocking Object class declarations.
the Semaphore class provides Binary & Counting semaphore objects, based on BlockingObject base class...
Definition: ksemaphore.h:36
Definition: atomic.cpp:23
Mark3 Kernel Configuration This file is used to configure the kernel for your specific application in...
The Mutex Class. Class providing Mutual-exclusion locks, based on BlockingObject. ...
Definition: mutex.h:63
void Wait(Mutex *pclMutex_)
Wait Block the current thread, and wait for the object to be signalled. The specified mutex will be l...
Definition: condvar.cpp:32
Semaphore m_clSemaphore
Definition: condvar.h:83
void Init()
Init Initialize the condition variable prior to use. Must be called before the object can be used...
Definition: condvar.cpp:25
void Signal()
Signal Signal/Unblock the next thread currently blocked on this condition variable.
Definition: condvar.cpp:66
Mutual exclusion class declaration Resource locks are implemented using mutual exclusion semaphores (...
The ConditionVariable class This class implements a condition variable. This is a synchronization obj...
Definition: condvar.h:39
void Broadcast()
Broadcast Unblock all threads currently blocked on this condition variable.
Definition: condvar.cpp:77