|
Open Model Railroad Network (OpenMRN)
|
Notifiable class that can act as a BarrierNotifiable but also be enlisted in a queue. More...
Public Member Functions | |
| void | notify () override |
| Notification implementation. | |
| void | check_one_count () |
| Checks that there is exactly one count in here. | |
Public Member Functions inherited from BarrierNotifiable | |
| BarrierNotifiable () | |
| Constructs a barrier notifiable that is done. | |
| BarrierNotifiable (Notifiable *done) | |
| Constructs a barrier notifiable that is live. | |
| BarrierNotifiable * | reset (Notifiable *done) |
| Resets the barrier. Returns &*this. Asserts that is_done(). | |
| BarrierNotifiable * | new_child () |
| Call this for each child task. | |
| void | maybe_done () |
| When there are no more child tasks to add, call maybe_done(). | |
| bool | is_done () |
| bool | abort_if_almost_done () |
| Checks if there is exactly one outstanding notification left in the barrier. | |
Public Member Functions inherited from QMember | |
| void | init () |
| Initiailize a QMember, in place of a public placement construction. | |
Additional Inherited Members | |
Protected Member Functions inherited from Atomic | |
| void | lock () |
| void | unlock () |
Protected Member Functions inherited from QMember | |
| QMember () | |
| Constructor. | |
| ~QMember () | |
| Destructor. | |
Protected Attributes inherited from BarrierNotifiable | |
| unsigned | count_ |
| How many outstanding notifications we are still waiting for. | |
| Notifiable * | done_ |
| Notifiable to call when the barrier reaches zero. | |
Protected Attributes inherited from QMember | |
| QMember * | next |
| pointer to the next member in the queue | |
Notifiable class that can act as a BarrierNotifiable but also be enlisted in a queue.
Definition at line 58 of file AsyncNotifiableBlock.hxx.
|
inline |
Checks that there is exactly one count in here.
Definition at line 86 of file AsyncNotifiableBlock.hxx.
|
inlineoverridevirtual |
Notification implementation.
Theory of operation: If this was the last notification (count goes from 1 to 0), we take the done_ pointer, cast it to the owning AsyncNotifiableBlock, and release outselves into the queue there. We keep the count at 1 at all times, which ensures that the done_ pointer remains pointing to the owner AsyncNotifiableBlock.
Reimplemented from BarrierNotifiable.
Definition at line 68 of file AsyncNotifiableBlock.hxx.