Re: poa issue



Hi Mark,

        I thought I'd CC this to the list, for wider thought.            
   
On Wed, 11 Jul 2001, Mark McLoughlin wrote:
>       The problem is that the deactivation doesn't actually take place
> until after the request has completed and the gobject freed. This
> leaves servant->_private (which is a GSList *) as garbage, so there is
> no way to know that the servant has been freed.

        Yes. So, the thing is that I think it's reasonable to expect the
ORB to get this right; if I do:

        PortableServer_POA_deactivate_object (bonobo_poa (), oid, &ev);
and then:

        PortableServer_ServantBase__fini (&object->servant, &ev);
        
        I think I should be able to free the servant, since the object is
deactivated, and the servant is finalized.

        So ... of course I don't understand the POA [ or indeed why it
should be quite so complex ], but it all comes down to:

void
ORBit_POA_deactivate_object(PortableServer_POA poa, ORBit_POAObject *pobj,
                             CORBA_boolean do_etherealize,
                             CORBA_boolean is_cleanup)
{
    PortableServer_ServantBase  *serv = pobj->servant;
    GSList                      **obj_list;

    if ( serv == NULL ) {
            /* deactivation has already occured, or is in progress */
            return;
    }
    if ( do_etherealize && (pobj->life_flags&ORBit_LifeF_DeactivateDo)==0)
        pobj->life_flags |= ORBit_LifeF_DoEtherealize;
    if ( is_cleanup )
        pobj->life_flags |= ORBit_LifeF_IsCleanup;
    if ( pobj->use_cnt > 0 ) {
        pobj->life_flags |= ORBit_LifeF_DeactivateDo;
        pobj->life_flags |= ORBit_LifeF_NeedPostInvoke;
        return;
    }
    pobj->servant = NULL;
    obj_list = ORBIT_SERVANT_TO_POAOBJECT_LIST_ADDR(serv);
    *obj_list = g_slist_remove(*obj_list,pobj);
    
        so I neither know, nor care much about 'etherialization' and the
complexities of deactivating the POA object - in fact I'd be quite happy
if the POA didn't exist at all :-). Either way, I can see 2 solutions.  

        a) Move the pobj->servant = NULL & list free above the 'use_cnt'
check[1], perhaps this breaks the spec. ?

        b) Make:

void
PortableServer_ServantBase__fini(PortableServer_Servant p_servant,
                                 CORBA_Environment *ev)
{
}  

        walk its list of PObj's detatching itself from each of them.

        What do you think is the correct solution ?

        Regards,
        
                Michael.

[1] NB. this use_cnt manipulation should probably have locks around it 
somehow anyway.

-- 
 mmeeks@gnu.org  <><, Pseudo Engineer, itinerant idiot





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]