mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-31 00:24:51 +00:00
parent
298f317f44
commit
4e57b6eceb
@ -283,21 +283,22 @@ Cpu_session_component::~Cpu_session_component()
|
|||||||
|
|
||||||
void Cpu_session_component::_deinit_ref_account()
|
void Cpu_session_component::_deinit_ref_account()
|
||||||
{
|
{
|
||||||
/* without a ref-account, nothing has do be done */
|
/* rewire child ref accounts to this sessions's ref account */
|
||||||
if (!_ref) { return; }
|
{
|
||||||
|
Lock::Guard lock_guard(_ref_members_lock);
|
||||||
|
for (Cpu_session_component * s; (s = _ref_members.first()); ) {
|
||||||
|
_unsync_remove_ref_member(*s);
|
||||||
|
if (_ref)
|
||||||
|
_ref->_insert_ref_member(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* give back our remaining quota to our ref account */
|
if (_ref) {
|
||||||
_transfer_quota(*_ref, _quota);
|
/* give back our remaining quota to our ref account */
|
||||||
|
_transfer_quota(*_ref, _quota);
|
||||||
|
|
||||||
/* remove ref-account relation between us and our ref-account */
|
/* remove ref-account relation between us and our ref-account */
|
||||||
Cpu_session_component * const orig_ref = _ref;
|
_ref->_remove_ref_member(*this);
|
||||||
_ref->_remove_ref_member(*this);
|
|
||||||
|
|
||||||
/* redirect ref-account relation of ref members to our prior ref account */
|
|
||||||
Lock::Guard lock_guard(_ref_members_lock);
|
|
||||||
for (Cpu_session_component * s; (s = _ref_members.first()); ) {
|
|
||||||
_unsync_remove_ref_member(*s);
|
|
||||||
orig_ref->_insert_ref_member(s);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -682,6 +682,23 @@ static void test_successive_create_destroy_threads(Env &env)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************************
|
||||||
|
** Test destruction of inter-dependent CPU sessions **
|
||||||
|
******************************************************/
|
||||||
|
|
||||||
|
static void test_destroy_dependent_cpu_sessions(Env &env)
|
||||||
|
{
|
||||||
|
log("destroy dependent CPU sessions in wrong order");
|
||||||
|
|
||||||
|
Cpu_connection grandchild { env };
|
||||||
|
Cpu_connection child { env };
|
||||||
|
|
||||||
|
grandchild.ref_account(child.rpc_cap());
|
||||||
|
|
||||||
|
/* when leaving the scope, 'child' is destructed before 'grandchild' */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Component::construct(Env &env)
|
void Component::construct(Env &env)
|
||||||
{
|
{
|
||||||
log("--- thread test started ---");
|
log("--- thread test started ---");
|
||||||
@ -689,6 +706,9 @@ void Component::construct(Env &env)
|
|||||||
Attached_rom_dataspace config(env, "config");
|
Attached_rom_dataspace config(env, "config");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
test_destroy_dependent_cpu_sessions(env);
|
||||||
|
|
||||||
test_stack_alloc(env);
|
test_stack_alloc(env);
|
||||||
test_stack_alignment(env);
|
test_stack_alignment(env);
|
||||||
test_main_thread();
|
test_main_thread();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user