Loading...
Searching...
No Matches
poll_timeout_counter.h
/*
* Copyright (C) 2012 Technische Universität Dresden.
* Author(s): Adam Lackorzynski <adam@os.inf.tu-dresden.de>
*
* License: see LICENSE.spdx (in this directory or the directories above)
*/
#pragma once
namespace L4 {
class Poll_timeout_counter
{
public:
Poll_timeout_counter(unsigned counter_val)
{
set(counter_val);
}
void set(unsigned counter_val)
{
_c = counter_val;
}
bool test(bool expression = true)
{
if (!expression)
return false;
if (_c)
{
--_c;
return true;
}
return false;
}
bool timed_out() const { return _c == 0; }
private:
unsigned _c;
};
}
L4::Poll_timeout_counter::set
void set(unsigned counter_val)
Set the counter to a certain value.
Definition poll_timeout_counter.h:53
L4::Poll_timeout_counter::Poll_timeout_counter
Poll_timeout_counter(unsigned counter_val)
Constructor.
Definition poll_timeout_counter.h:42
L4::Poll_timeout_counter::test
bool test(bool expression=true)
Evaluate the expression for a maximum number of times.
Definition poll_timeout_counter.h:61
L4::Poll_timeout_counter::timed_out
bool timed_out() const
Indicator if the maximum number of tests was required.
Definition poll_timeout_counter.h:81
L4
L4 low-level kernel interface.
Definition l4sys-l4f-groups.dox:50