10#include <l4/re/util/object_registry>
11#include <l4/re/util/br_manager>
12#include <l4/cxx/ipc_timeout_queue>
13#include <l4/cxx/ref_ptr>
15#include <l4/libblock-device/debug.h>
19namespace Block_device {
namespace Errand {
27typedef std::function<void()> Callback;
54 Err().printf(
"Polling task failed: %s\n", e.
str());
68 template<
typename T,
typename... Args >
73 Poll_errand(
int retries,
int interval,
74 std::function<
bool()>
const &poll_func,
75 std::function<
void(
bool)>
const &callback)
84 std::function<bool()> _poll;
85 std::function<void(
bool)> _callback;
116 Err().printf(
"Asynchronous task failed: %s\n", e.
str());
121 void reschedule(
unsigned interval = 0)
130 template<
typename T,
typename... Args >
135 Errand(Callback
const &callback) : _callback(callback) {}
166inline void schedule(Callback
const &callback,
int interval)
168 cxx::make_ref_obj<Errand>(callback)->reschedule(interval);
191inline void poll(
int retries,
int interval,
192 std::function<
bool()>
const &poll_func,
193 std::function<
void(
bool)>
const &callback)
198 cxx::make_ref_obj<Poll_errand>(retries, interval, poll_func,
199 callback)->reschedule();
Wrapper for a small task executed asynchronously in the server loop.
void expired() final
callback function to be called when timeout happened
Wrapper for a regularly repeated task.
void expired() final
callback function to be called when timeout happened
A server loop object which has a Object_registry included.
Interface for server-loop related functions.
virtual int add_timeout(Timeout *timeout, l4_kernel_clock_t time)=0
Add a timeout to the server internal timeout queue.
Loop hooks mixin for integrating a timeout queue into the server loop.
Callback interface for Timeout_queue.
Exception for an abstract runtime error.
char const * str() const noexcept override
Return a human readable string for the exception.
A reference-counting pointer with automatic cleanup.
l4_kernel_info_t const * l4re_kip(void) L4_NOTHROW
Get Kernel Info Page.
l4_uint64_t l4_kernel_clock_t
Kernel clock type.
l4_cpu_time_t l4_kip_clock(l4_kernel_info_t const *kip) L4_NOTHROW
Return clock value from the KIP.
Mix in for LOOP_HOOKS to ignore IPC errors.