mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-23 09:15:36 +00:00
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:
committed by
Norman Feske
parent
ca37f26a01
commit
c2d3543e62
@ -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 */
|
||||
|
Reference in New Issue
Block a user