mirror of
https://github.com/mmueller41/genode.git
synced 2026-01-21 12:32:56 +01:00
Example code for persistent cell.
This commit is contained in:
36
repos/mml/src/app/persistent_cell/persistent_cell.cc
Normal file
36
repos/mml/src/app/persistent_cell/persistent_cell.cc
Normal 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); }
|
||||
3
repos/mml/src/app/persistent_cell/target.mk
Normal file
3
repos/mml/src/app/persistent_cell/target.mk
Normal file
@@ -0,0 +1,3 @@
|
||||
TARGET = persistent_cell
|
||||
SRC_CC = persistent_cell.cc
|
||||
LIBS += base
|
||||
Reference in New Issue
Block a user