34#ifndef _FREERTOS_DRIVERS_COMMON_BLOCKORWAKEUP_HXX_
35#define _FREERTOS_DRIVERS_COMMON_BLOCKORWAKEUP_HXX_
80 friend class LockHolder;
81 friend class CriticalHolder;
165 parent_->notifiable_ =
nullptr;
191 s_.post_from_isr(&woken);
196 os_isr_exit_yield_test(
true);
A synchronization primitive for device drivers, where execution has to happen in an interrupt context...
OSSem s_
Semaphore used to wake up callers.
Notifiable * register_notifiable(Notifiable *n)
Sets the notifiable that will be called from the ISR (or regular) context when there is more data to ...
BlockOrWakeUp(const T &t)
Constructor.
LockHolder holder()
Acquires a lock (not critical) and returns an RAII holder object.
OSMutex m_
Mutex holding non-criticla lock.
void single_unlock()
Unlocks the mutex (not the critical).
Notifiable * notifiable_
Notifiable to be woken up when an ISR event happens.
void single_lock()
Locks the mutex (not the critical).
void notify_from_isr()
Called from ISR context to wake up a regular context or a caller waiting.
An object that can schedule itself on an executor to run.
virtual void notify()=0
Generic callback.
This class provides a mutex API.
void unlock()
Unlock a mutex.
This class provides a counting semaphore API.
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
Removes default copy-constructor and assignment added by C++.
RAII class for holding a critical section lock.
CriticalHolder(BlockOrWakeUp< Critical > *parent)
Upgrades a lock to a critical section.
CriticalHolder(CriticalHolder &&o)
Move constructor for the RAII object.
BlockOrWakeUp< Critical > * parent_
Pointer to parent.
RAII class for holding a mutex lock that can be upgraded to a critical section lock.
void wait_for_notification()
Waits for the core condition to be true (i.e.
LockHolder(LockHolder &&o)
Move constructor.
BlockOrWakeUp< Critical > * parent_
Parent object whose lock we are holding.
void notify_next()
Hands over the core condition to a next someone waiting in line.
LockHolder(BlockOrWakeUp< Critical > *parent)
Constructor.
CriticalHolder critical()
upgrades a regular lock to a critical section.