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, * return value is 'true' and the alarm is periodically scheduled,
* the alarm is scheduled again. * the alarm is scheduled again.
*/ */
virtual bool on_alarm() { return false; } virtual bool on_alarm(unsigned) { return false; }
public: public:

View File

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

View File

@ -122,9 +122,9 @@ namespace Timer {
* *
* This function gets called by the 'Alarm_scheduler' thread. * 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; return _periodic;
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -44,7 +44,7 @@ PSUPGLOBALINFOPAGE g_pSUPGlobalInfoPage;
class Periodic_GIP : public Genode::Alarm { 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 * We're using rdtsc here since timer_session->elapsed_ms produces