38#ifndef _EXECUTOR_SEMAPHORENOTIFIABLEBLOCK_HXX_
39#define _EXECUTOR_SEMAPHORENOTIFIABLEBLOCK_HXX_
52 ,
sem_(num_parallelism)
67 for (
unsigned i = 0; i <
count_; ++i) {
72 DIE(
"SempahoreNotifiableBlock: could not find a free barrier.");
81#if OPENMRN_FEATURE_RTOS_FROM_ISR
85 sem_.post_from_isr(&woken);
See OSMutexLock in os/OS.hxx.
Lightweight locking class for protecting small critical sections.
A BarrierNotifiable allows to create a number of child Notifiable and wait for all of them to finish.
BarrierNotifiable * reset(Notifiable *done)
Resets the barrier. Returns &*this. Asserts that is_done().
An object that can schedule itself on an executor to run.
This class provides a counting semaphore API.
void post()
Post (increment) a semaphore.
void wait()
Wait on (decrement) a semaphore.
A block of BarrierNotifiable objects, with a synchronous allocation call.
void notify() override
Internal: notifies that a barrier has been returned.
BarrierNotifiable * acquire()
Gets a barrier notifiable.
SemaphoreNotifiableBlock(unsigned num_parallelism)
constructor.
OSSem sem_
Semaphore holding free barriers.
BarrierNotifiable * barriers_
The raw pointer to the block of barriernotifiables.
unsigned count_
How many barriers did we allocate in total?
#define OVERRIDE
Function attribute for virtual functions declaring that this funciton is overriding a funciton that s...
#define DIE(MSG)
Unconditionally terminates the current process with a message.
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
Removes default copy-constructor and assignment added by C++.