Provide children with information about what new resources have been allocated.

This commit is contained in:
Michael Mueller
2023-06-13 18:39:23 +02:00
parent d72527809b
commit c72849ee95
4 changed files with 36 additions and 1 deletions

View File

@@ -300,6 +300,8 @@ class Genode::Child : protected Rpc_object<Parent>,
/* arguments fetched by the child in response to a yield signal */
Mutex _yield_request_mutex { };
Resource_args _yield_request_args { };
Mutex _resource_gain_mutex { };
Resource_args _gained_resources { };
/* number of unanswered heartbeat signals */
unsigned _outstanding_heartbeats = 0;
@@ -782,6 +784,14 @@ class Genode::Child : protected Rpc_object<Parent>,
*/
void yield(Resource_args const &args);
/**
* Bestow resources on the child
*
* By calling this method, the child will be notified about
* the having gained the specified amount of resources.
*/
void accept(Resource_args const &args);
/**
* Notify the child about newly available resources
*/
@@ -818,6 +828,7 @@ class Genode::Child : protected Rpc_object<Parent>,
void resource_request(Resource_args const &) override;
void yield_sigh(Signal_context_capability) override;
Resource_args yield_request() override;
Resource_args gained_resources() override;
void yield_response() override;
void heartbeat_sigh(Signal_context_capability) override;
void heartbeat_response() override;

View File

@@ -67,6 +67,8 @@ struct Genode::Parent_client : Rpc_client<Parent>
call<Rpc_yield_sigh>(sigh); }
Resource_args yield_request() override { return call<Rpc_yield_request>(); }
Resource_args gained_resources() override { return call<Rpc_gained_resources>(); }
void yield_response() override { call<Rpc_yield_response>(); }

View File

@@ -281,6 +281,12 @@ class Genode::Parent
*/
virtual void yield_response() = 0;
/**
* Obtain information about the resources gained, e.g. from a resource request
*
*/
virtual Resource_args gained_resources() = 0;
/*
* Health monitoring
*/
@@ -334,6 +340,7 @@ class Genode::Parent
Resource_args const &);
GENODE_RPC(Rpc_yield_sigh, void, yield_sigh, Signal_context_capability);
GENODE_RPC(Rpc_yield_request, Resource_args, yield_request);
GENODE_RPC(Rpc_gained_resources, Resource_args, gained_resources);
GENODE_RPC(Rpc_yield_response, void, yield_response);
GENODE_RPC(Rpc_heartbeat_sigh, void, heartbeat_sigh, Signal_context_capability);
GENODE_RPC(Rpc_heartbeat_response, void, heartbeat_response);
@@ -343,7 +350,7 @@ class Genode::Parent
Rpc_close, Rpc_session_response, Rpc_main_thread,
Rpc_deliver_session_cap, Rpc_resource_avail_sigh,
Rpc_resource_request, Rpc_yield_sigh,
Rpc_yield_request, Rpc_yield_response,
Rpc_yield_request, Rpc_yield_response, Rpc_gained_resources,
Rpc_heartbeat_sigh, Rpc_heartbeat_response);
};