19#include <l4/cxx/hlist>
20#include <l4/sys/cxx/ipc_server_loop>
22namespace L4 {
namespace Ipc_svr {
77 if (
auto e = _timeouts.
front())
94 return (next != 0) && (next <= now);
103 while (!_timeouts.
empty())
105 Queue::Iterator top = _timeouts.
begin();
106 if ((*top)->_timeout > now)
110 top = _timeouts.
erase(top);
123 timeout->_timeout = time;
124 Queue::Iterator i = _timeouts.
begin();
125 while (i != _timeouts.
end() && (*i)->timeout() < time)
138 _timeouts.
remove(timeout);
159template<
typename HOOKS,
typename BR_MAN = Br_manager_no_buffers >
163 {
return static_cast<HOOKS*
>(
this)->now(); }
165 unsigned _timeout_br()
190 BR_MAN::setup_wait(utcb, mode);
unsigned first_free_br() const
Returns 1 as first free buffer.
Loop hooks mixin for integrating a timeout queue into the server loop.
int add_timeout(Timeout *timeout, l4_kernel_clock_t time) override
Add a timeout to the queue for time time.
L4::Ipc_svr::Reply_mode before_reply(l4_msgtag_t, l4_utcb_t *)
server loop hook
int remove_timeout(Timeout *timeout) override
Remove timeout from the queue.
void setup_wait(l4_utcb_t *utcb, L4::Ipc_svr::Reply_mode mode)
setup_wait() for the server loop
l4_timeout_t timeout()
get the time for the next timeout
Timeout_queue queue
Use this timeout queue.
Timeout queue to be used in l4re server loop.
void remove(Timeout *timeout)
Remove timeout from the queue.
L4::Ipc_svr::Timeout Timeout
Provide a local definition of Timeout for backward compatibility.
l4_kernel_clock_t next_timeout() const
Get the time for the next timeout.
void handle_expired_timeouts(l4_kernel_clock_t now)
run the callbacks of expired timeouts
bool timeout_expired(l4_kernel_clock_t now) const
Determine if a timeout has happened.
void add(Timeout *timeout, l4_kernel_clock_t time)
Add a timeout to the queue.
Callback interface for Timeout_queue.
virtual void expired()=0
callback function to be called when timeout happened
virtual ~Timeout()=0
Destroy a timeout.
l4_kernel_clock_t timeout() const
return absolute timeout of this callback.
Const_iterator end() const
Return a const iterator to the end of the list.
bool empty() const
Check if the list is empty.
Iterator begin()
Return an iterator to the beginning of the list.
Value_type front() const
Return the first element in the list.
Basic element type for a double-linked H_list.
General double-linked list of unspecified cxx::H_list_item elements.
static Iterator erase(Iterator const &e)
Remove the element at the given iterator position.
static void insert_before(T *e, Iterator const &succ)
Insert an element before the iterator position.
static void remove(T *e)
Remove the given element from its list.
Reply_mode
Reply mode for server loop.
@ Reply_separate
Server shall call reply and wait separately.
@ Reply_compound
Server shall use a compound reply and wait (fast).
l4_uint64_t l4_kernel_clock_t
Kernel clock type.
#define L4_IPC_TIMEOUT_0
Timeout constants.
#define L4_IPC_SEND_TIMEOUT_0
0 send timeout
L4_CONSTEXPR l4_timeout_t l4_timeout(l4_timeout_s snd, l4_timeout_s rcv) L4_NOTHROW
Combine send and receive timeout in a timeout.
l4_timeout_s l4_timeout_abs(l4_kernel_clock_t pint, int br) L4_NOTHROW
Set an absolute timeout.
struct l4_utcb_t l4_utcb_t
Opaque type for the UTCB.
L4 low-level kernel interface.
Message tag data structure.