10#include <l4/sys/cxx/ipc_server_loop>
20 friend class Timeout_queue;
67 if (
auto e = _timeouts.front())
84 return (next != 0) && (next <= now);
93 while (!_timeouts.empty())
95 Queue::Iterator top = _timeouts.begin();
96 if ((*top)->_timeout > now)
100 top = _timeouts.erase(top);
113 timeout->_timeout = time;
114 Queue::Iterator i = _timeouts.begin();
115 while (i != _timeouts.end() && (*i)->timeout() < time)
118 _timeouts.insert_before(timeout, i);
128 _timeouts.remove(timeout);
149template<
typename HOOKS,
typename BR_MAN = Br_manager_no_buffers >
153 {
return static_cast<HOOKS*
>(
this)->now(); }
155 unsigned _timeout_br()
176 if (
queue.timeout_expired(now))
177 queue.handle_expired_timeouts(now);
180 BR_MAN::setup_wait(utcb, mode);
187 if (
queue.timeout_expired(_now()))
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.
General double-linked list of unspecified cxx::H_list_item elements.
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.
Helper classes for L4::Server instantiation.
L4 low-level kernel interface.
H_list_item_t< void > H_list_item
Untyped list item.
Message tag data structure.