parent
beb8bf498c
commit
5b633a83df
|
@ -99,6 +99,21 @@ class Genode::Cpu_thread_component : public Rpc_object<Cpu_thread>,
|
||||||
|
|
||||||
Trace::Source_registry &_trace_sources;
|
Trace::Source_registry &_trace_sources;
|
||||||
|
|
||||||
|
struct Managed_thread_cap
|
||||||
|
{
|
||||||
|
Rpc_entrypoint &_ep;
|
||||||
|
Cpu_thread_component &_thread;
|
||||||
|
Thread_capability const _cap;
|
||||||
|
|
||||||
|
Managed_thread_cap(Rpc_entrypoint &ep, Cpu_thread_component &thread)
|
||||||
|
: _ep(ep), _thread(thread), _cap(_ep.manage(&thread))
|
||||||
|
{ }
|
||||||
|
|
||||||
|
~Managed_thread_cap() { _ep.dissolve(&_thread); }
|
||||||
|
|
||||||
|
Thread_capability cap() const { return _cap; }
|
||||||
|
} const _managed_thread_cap;
|
||||||
|
|
||||||
Rm_client _rm_client;
|
Rm_client _rm_client;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -146,24 +161,14 @@ class Genode::Cpu_thread_component : public Rpc_object<Cpu_thread>,
|
||||||
_bound_to_pd(_bind_to_pd(pd)),
|
_bound_to_pd(_bind_to_pd(pd)),
|
||||||
_trace_control_slot(trace_control_area),
|
_trace_control_slot(trace_control_area),
|
||||||
_trace_sources(trace_sources),
|
_trace_sources(trace_sources),
|
||||||
_rm_client(cpu_session_cap, _ep.manage(this),
|
_managed_thread_cap(_ep, *this),
|
||||||
|
_rm_client(cpu_session_cap, _managed_thread_cap.cap(),
|
||||||
_address_space_region_map,
|
_address_space_region_map,
|
||||||
_platform_thread.pager_object_badge(),
|
_platform_thread.pager_object_badge(),
|
||||||
_platform_thread.affinity(),
|
_platform_thread.affinity(),
|
||||||
pd.label(), name)
|
pd.label(), name)
|
||||||
{
|
{
|
||||||
/*
|
_pager_ep.manage(_rm_client);
|
||||||
* Acquaint thread with its pager object, caution on some base platforms
|
|
||||||
* this may raise an 'Out_of_ram' exception, which causes the
|
|
||||||
* destructor of this object to not being called. Catch it and remove this
|
|
||||||
* object from the object pool
|
|
||||||
*/
|
|
||||||
try {
|
|
||||||
_pager_ep.manage(_rm_client);
|
|
||||||
} catch (...) {
|
|
||||||
_ep.dissolve(this);
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
|
|
||||||
_address_space_region_map.add_client(_rm_client);
|
_address_space_region_map.add_client(_rm_client);
|
||||||
_platform_thread.pager(_rm_client);
|
_platform_thread.pager(_rm_client);
|
||||||
|
@ -174,7 +179,6 @@ class Genode::Cpu_thread_component : public Rpc_object<Cpu_thread>,
|
||||||
{
|
{
|
||||||
_trace_sources.remove(&_trace_source);
|
_trace_sources.remove(&_trace_source);
|
||||||
_pager_ep.dissolve(_rm_client);
|
_pager_ep.dissolve(_rm_client);
|
||||||
_ep.dissolve(this);
|
|
||||||
|
|
||||||
_address_space_region_map.remove_client(_rm_client);
|
_address_space_region_map.remove_client(_rm_client);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue