Example code for persistent cell.

This commit is contained in:
Michael Mueller
2023-08-07 17:53:44 +02:00
parent e58e468808
commit 4ee2070573
2 changed files with 39 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
#include <base/component.h>
#include <base/env.h>
#include <base/log.h>
#include <timer_session/connection.h>
namespace Hoitaja_test {
struct Persistent_cell;
}
struct Hoitaja_test::Persistent_cell
{
Genode::Env &_env;
Timer::Connection _timer{_env};
void _handle_timeout()
{
Genode::log("My affinity is ", _env.cpu().affinity_space());
Genode::log("My PD cap is ", _env.pd_session_cap());
_timer.trigger_once(5 * 1000 * 1000);
}
Genode::Signal_handler<Persistent_cell> _timeout_handler{
_env.ep(), *this, &Persistent_cell::_handle_timeout};
Persistent_cell(Genode::Env &env) : _env(env)
{
Genode::log("My affinity is ", _env.cpu().affinity_space());
Genode::log("My PD cap is ", _env.pd().address_space());
_timer.sigh(_timeout_handler);
_timer.trigger_once(5 * 1000 * 1000);
}
};
void Component::construct(Genode::Env &env) { static Hoitaja_test::Persistent_cell cell(env); }

View File

@@ -0,0 +1,3 @@
TARGET = persistent_cell
SRC_CC = persistent_cell.cc
LIBS += base