base: implement Object_pool::first_locked()

ref #589
This commit is contained in:
Martin Stein 2013-09-12 21:09:05 +02:00 committed by Norman Feske
parent 84c31a7ea1
commit 1571e09823
1 changed files with 13 additions and 0 deletions

View File

@ -196,6 +196,19 @@ namespace Genode {
Lock::Guard lock_guard(_lock);
return (OBJ_TYPE *)_tree.first();
}
/**
* Return first element of tree locked
*
* This function is used for removing tree elements step by step.
*/
OBJ_TYPE *first_locked()
{
Lock::Guard lock_guard(_lock);
OBJ_TYPE * const obj_typed = (OBJ_TYPE *)_tree.first();
obj_typed->lock();
return obj_typed;
}
};
}