mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-31 00:24:51 +00:00
Destruct IPC-server object on entrypoint destruction
The IPC-server object exists solely on the stack of the entrypoint thread and, therefore, would never be destructed as the thread is just killed. Now, the object is explicitly destructed in the entrypoint destructor. An alternative solution could instruct the entrypoint thread the terminate, which would automatically cleanup its stack. The object pool is assumed to be empty on destruction of the entrypoint. If not, we warn and at least dissolve all RPC objects.
This commit is contained in:
parent
2cdac0eb32
commit
d23ee02e9a
@ -254,3 +254,17 @@ Rpc_entrypoint::Rpc_entrypoint(Cap_session *cap_session, size_t stack_size,
|
||||
if (start_on_construction)
|
||||
activate();
|
||||
}
|
||||
|
||||
|
||||
Rpc_entrypoint::~Rpc_entrypoint()
|
||||
{
|
||||
typedef Object_pool<Rpc_object_base> Pool;
|
||||
|
||||
if (Pool::first()) {
|
||||
PWRN("Object pool not empty in %s", __func__);
|
||||
|
||||
/* dissolve all objects - objects are not destroyed! */
|
||||
while (Rpc_object_base *obj = Pool::first())
|
||||
_dissolve(obj);
|
||||
}
|
||||
}
|
||||
|
@ -318,6 +318,8 @@ namespace Genode {
|
||||
Rpc_entrypoint(Cap_session *cap_session, size_t stack_size,
|
||||
char const *name, bool start_on_construction = true);
|
||||
|
||||
~Rpc_entrypoint();
|
||||
|
||||
/**
|
||||
* Associate RPC object with the entry point
|
||||
*/
|
||||
|
@ -104,3 +104,19 @@ Rpc_entrypoint::Rpc_entrypoint(Cap_session *cap_session, size_t stack_size,
|
||||
if (start_on_construction)
|
||||
activate();
|
||||
}
|
||||
|
||||
|
||||
Rpc_entrypoint::~Rpc_entrypoint()
|
||||
{
|
||||
typedef Object_pool<Rpc_object_base> Pool;
|
||||
|
||||
if (Pool::first()) {
|
||||
PWRN("Object pool not empty in %s", __func__);
|
||||
|
||||
/* dissolve all objects - objects are not destroyed! */
|
||||
while (Rpc_object_base *obj = Pool::first())
|
||||
_dissolve(obj);
|
||||
}
|
||||
|
||||
_ipc_server->~Ipc_server();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user