Add simple async signal example
This commit is contained in:
19
include/signals_session/client.h
Normal file
19
include/signals_session/client.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#ifndef _INCLUDE__SIGNALS_SESSION__CLIENT_H_
|
||||
#define _INCLUDE__SIGNALS_SESSION__CLIENT_H_
|
||||
|
||||
#include <signals_session/signals_session.h>
|
||||
#include <base/rpc_client.h>
|
||||
|
||||
namespace Signals { struct Session_client; }
|
||||
|
||||
struct Signals::Session_client : Genode::Rpc_client<Session>
|
||||
{
|
||||
Session_client(Genode::Capability<Session> cap) : Genode::Rpc_client<Session>(cap) {
|
||||
}
|
||||
|
||||
Genode::Signal_context_capability get_sig_con() override {
|
||||
return call<Rpc_get_sig_con>();
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* _INCLUDE__SIGNALS_SESSION__CLIENT_H_ */
|
||||
14
include/signals_session/connection.h
Normal file
14
include/signals_session/connection.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#ifndef _INCLUDE__SIGNALS_SESSION__CONNECTION_H_
|
||||
#define _INCLUDE__SIGNALS_SESSION__CONNECTION_H_
|
||||
|
||||
#include <signals_session/client.h>
|
||||
#include <base/connection.h>
|
||||
|
||||
namespace Signals { struct Connection; }
|
||||
|
||||
struct Signals::Connection : Genode::Connection<Session>, Session_client {
|
||||
Connection(Genode::Env &env) : Genode::Connection<Signals::Session>(env, session(env.parent(), "ram_quota=6K, cap_quota=4")),
|
||||
Session_client(cap()) { }
|
||||
};
|
||||
|
||||
#endif /* _INCLUDE__SIGNALS_SESSION__CONNECTION_H_ */
|
||||
21
include/signals_session/signals_session.h
Normal file
21
include/signals_session/signals_session.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef _INCLUDE__SIGNALS_SESSION__SIGNALS_SESSION_H
|
||||
#define _INCLUDE__SIGNALS_SESSION__SIGNALS_SESSION_H
|
||||
|
||||
#include <session/session.h>
|
||||
#include <base/rpc.h>
|
||||
|
||||
namespace Signals { struct Session; }
|
||||
|
||||
struct Signals::Session : Genode::Session {
|
||||
static const char *service_name() { return "Signals"; }
|
||||
|
||||
enum { CAP_QUOTA = 2 };
|
||||
|
||||
virtual Genode::Signal_context_capability get_sig_con() = 0;
|
||||
|
||||
GENODE_RPC(Rpc_get_sig_con, Genode::Signal_context_capability, get_sig_con);
|
||||
|
||||
GENODE_RPC_INTERFACE(Rpc_get_sig_con);
|
||||
};
|
||||
|
||||
#endif /* _INCLUDE__SIGNALS_SESSION__SIGNALS_SESSION_H */
|
||||
Reference in New Issue
Block a user