os: extend on_alarm() by unsigned count value

The count value can be used to batch timeouts. I.e., if a periodic
timeout triggered multiple times before the timer had a chance to
process them, the count corresponds to the number of passed periods.
This commit is contained in:
Alexander Boettcher 2014-06-24 13:35:17 +02:00 committed by Norman Feske
parent 1c99ee951a
commit ca9f0ba89c
9 changed files with 12 additions and 11 deletions

View File

@ -52,7 +52,7 @@ namespace Genode {
* return value is 'true' and the alarm is periodically scheduled,
* the alarm is scheduled again.
*/
virtual bool on_alarm() { return false; }
virtual bool on_alarm(unsigned) { return false; }
public:

View File

@ -155,7 +155,7 @@ namespace Genode {
protected:
bool on_alarm()
bool on_alarm(unsigned) override
{
/* Abort blocking operation */
_triggered = _sem->_abort(_element);

View File

@ -122,9 +122,9 @@ namespace Timer {
*
* This function gets called by the 'Alarm_scheduler' thread.
*/
bool on_alarm()
bool on_alarm (unsigned cnt) override
{
Signal_transmitter(_sigh).submit();
Signal_transmitter(_sigh).submit(cnt);
return _periodic;
}

View File

@ -113,7 +113,7 @@ void Alarm_scheduler::handle(Alarm::Time curr_time)
while ((curr = _get_pending_alarm())) {
/* do not reschedule if alarm function returns 0 */
bool reschedule = curr->on_alarm();
bool reschedule = curr->on_alarm(1);
if (reschedule) {

View File

@ -134,7 +134,7 @@ class dde_kit_timer : public Alarm, public List<dde_kit_timer>::Element
protected:
bool on_alarm()
bool on_alarm(unsigned) override
{
/* if timer is really pending, call registered handler function */
if (_pending) {

View File

@ -70,7 +70,7 @@ class One_shot_alarm : public Alarm
protected:
bool on_alarm()
bool on_alarm(unsigned) override
{
printf("one-shot alarm %s triggered\n", _name);
return false;
@ -95,7 +95,7 @@ class Periodic_alarm : public Alarm
protected:
bool on_alarm()
bool on_alarm(unsigned) override
{
printf("periodic alarm %s triggered\n", _name);
return true;

View File

@ -71,7 +71,7 @@ class One_shot : public Alarm
protected:
bool on_alarm()
bool on_alarm(unsigned) override
{
times_up = 1;
return false;

View File

@ -116,7 +116,8 @@ namespace Noux {
void discard() { _scheduler->discard(this); }
protected:
bool on_alarm()
bool on_alarm(unsigned) override
{
_state->timed_out = true;
_blocker->unlock();

View File

@ -44,7 +44,7 @@ PSUPGLOBALINFOPAGE g_pSUPGlobalInfoPage;
class Periodic_GIP : public Genode::Alarm {
bool on_alarm()
bool on_alarm(unsigned) override
{
/**
* We're using rdtsc here since timer_session->elapsed_ms produces