mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-18 10:46:25 +00:00
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:
parent
1c99ee951a
commit
ca9f0ba89c
@ -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:
|
||||
|
||||
|
@ -155,7 +155,7 @@ namespace Genode {
|
||||
|
||||
protected:
|
||||
|
||||
bool on_alarm()
|
||||
bool on_alarm(unsigned) override
|
||||
{
|
||||
/* Abort blocking operation */
|
||||
_triggered = _sem->_abort(_element);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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) {
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -71,7 +71,7 @@ class One_shot : public Alarm
|
||||
|
||||
protected:
|
||||
|
||||
bool on_alarm()
|
||||
bool on_alarm(unsigned) override
|
||||
{
|
||||
times_up = 1;
|
||||
return false;
|
||||
|
@ -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();
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user