Aufgabe 7: Anwendung
Manages and activates time-triggered activities. More...
#include <sync/bellringer.h>
| Static Public Member Functions | |
| static void | check () | 
| Checks whether there are bells to be rung.  More... | |
| static void | job (Bell *bell, unsigned int ms) | 
| Passes a bellto the bellringer to be rung aftermsmilliseconds.  More... | |
| static void | cancel (Bell *bell) | 
| Cancel ticking & ringing a bell.  More... | |
| static unsigned int | residual (Bell *bell) | 
| Returns the remaining time until bellwill ring.  More... | |
| static bool | bellPending () | 
| Checks whether there are enqueued bells.  More... | |
Detailed Description
Manages and activates time-triggered activities.
The Bellringer is regularly activated and checks whether any of the bells should ring. The bells are stored in a Queue<Bell> that is managed by the Bellringer. A clever implementation avoids iterating through the whole list for every iteration by keeping the bells sorted and storing delta times. This approach leads to a complexity of O(1) for the method called by the timer interrupt in case no bells need to be rung.
Member Function Documentation
| 
 | static | 
Checks whether there are bells to be rung.
Every call to check elapses a tick. Once such a tick reduces a bells remaining time to zero, the bell will be rung.
| 
 | static | 
Passes a bell to the bellringer to be rung after ms milliseconds. 
- Parameters
- 
  bell Bell that should be rung after msmillisecondsms number of milliseconds that should be waited before ringing the bell 
| 
 | static | 
Cancel ticking & ringing a bell.
- Parameters
- 
  bell Bell that should not be rung. 
| 
 | static | 
Returns the remaining time until bell will ring. 
- Parameters
- 
  bell The bell for which the remaining time should be returned 
- Returns
- Remaining time in milliseconds
- Optional:
- Implement Method
| 
 | static | 
Checks whether there are enqueued bells.
- Returns
- true if there are enqueued bells, false otherwise
The documentation for this class was generated from the following files:
- sync/bellringer.h
- sync/bellringer.cc