base: replace obj_by_* by lookup_and_lock

Add functionality to lookup an object and lock it. Additional the case is
handled that a object may be already in-destruction and the lookup will deny
returning the object.

The object_pool generalize the lookup and lock functionality of the rpc_server
and serve as base for following up patches to fix dangling pointer issues.
This commit is contained in:
Alexander Boettcher
2012-12-14 10:03:55 +01:00
committed by Norman Feske
parent ca37f26a01
commit c2d3543e62
51 changed files with 374 additions and 317 deletions

View File

@ -223,9 +223,8 @@ namespace Genode {
{
if (!args.is_valid_string()) throw Root::Invalid_args();
SESSION_TYPE *s =
dynamic_cast<SESSION_TYPE *>(_ep->obj_by_cap(session));
typedef typename Object_pool<SESSION_TYPE>::Guard Object_guard;
Object_guard s(_ep->lookup_and_lock(session));
if (!s) return;
_upgrade_session(s, args.string());
@ -233,9 +232,8 @@ namespace Genode {
void close(Session_capability session)
{
SESSION_TYPE *s =
dynamic_cast<SESSION_TYPE *>(_ep->obj_by_cap(session));
SESSION_TYPE * s =
dynamic_cast<SESSION_TYPE *>(_ep->lookup_and_lock(session));
if (!s) return;
/* let the entry point forget the session object */