19 #include <l4/cxx/hlist> 20 #include <l4/sys/cxx/ipc_server_loop> 22 namespace L4 {
namespace Ipc_svr {
76 if (
auto e = _timeouts.front())
93 return (next != 0) && (next <= now);
102 while (!_timeouts.empty())
104 Queue::Iterator top = _timeouts.begin();
105 if ((*top)->_timeout > now)
109 top = _timeouts.erase(top);
122 timeout->_timeout = time;
123 Queue::Iterator i = _timeouts.begin();
124 while (i != _timeouts.end() && (*i)->timeout() < time)
127 _timeouts.insert_before(timeout, i);
158 template<
typename HOOKS,
typename BR_MAN = Br_manager_no_buffers >
162 {
return static_cast<HOOKS*
>(
this)->now(); }
164 unsigned _timeout_br()
165 {
return this->first_free_br(); }
185 if (queue.timeout_expired(now))
186 queue.handle_expired_timeouts(now);
189 BR_MAN::setup_wait(utcb, mode);
196 if (queue.timeout_expired(_now()))
213 queue.add(timeout, time);
226 queue.remove(timeout);
l4_timeout_t l4_timeout(l4_timeout_s snd, l4_timeout_s rcv) L4_NOTHROW
Combine send and receive timeout in a timeout.
Reply_mode
Reply mode for server loop.
Server shall call reply and wait separately.
L4::Ipc_svr::Reply_mode before_reply(l4_msgtag_t, l4_utcb_t *)
server loop hook
void handle_expired_timeouts(l4_kernel_clock_t now)
run the callbacks of expired timeouts
Timeout queue to be used in l4re server loop.
L4 low-level kernel interface.
L4::Ipc_svr::Timeout Timeout
Provide a local definition of Timeout for backward compat.
void setup_wait(l4_utcb_t *utcb, L4::Ipc_svr::Reply_mode mode)
setup_wait() for the server loop
l4_kernel_clock_t timeout() const
return absolute timeout of this callback.
struct l4_utcb_t l4_utcb_t
Opaque type for the UTCB.
Callback interface for Timeout_queue.
l4_timeout_s l4_timeout_abs(l4_kernel_clock_t pint, int br) L4_NOTHROW
Set an absolute timeout.
l4_kernel_clock_t next_timeout() const
Get the time for the next timeout.
bool timeout_expired(l4_kernel_clock_t now) const
Determine if a timeout has happened.
virtual ~Timeout()=0
Destroy a timeout.
Basic element type for a double-linked H_list.
l4_uint64_t l4_kernel_clock_t
Kernel clock type.
Timeout_queue queue
Use this timeout queue.
virtual void expired()=0
callback function to be called when timeout happened
int add_timeout(Timeout *timeout, l4_kernel_clock_t time)
Add a timout to the queue for time time.
l4_timeout_t timeout()
get the time for the next timeout
int remove_timeout(Timeout *timeout)
Remove timeout from the queue.
#define L4_IPC_SEND_TIMEOUT_0
0 send timeout
void add(Timeout *timeout, l4_kernel_clock_t time)
Add a timeout to the queue.
#define L4_IPC_TIMEOUT_0
Timeout constants.
Message tag data structure.
Loop hooks mixin for integrating a timeout queue into the server loop.
Server shall use a compound reply and wait (fast).