Example #1
0
const void* SipXHandleMap::removeHandle(SIPXHANDLE handle) 
{
    const void* pRC = NULL ;
    
    if (lock())
    {
        releaseHandleRef(handle);
        
        UtlInt* pCount = static_cast<UtlInt*>(mLockCountHash.findValue(&UtlInt(handle))) ;
        
        if (pCount == NULL || pCount->getValue() < 1)
        {
            UtlInt key(handle) ;
            UtlVoidPtr* pValue ;
            
            pValue = (UtlVoidPtr*) findValue(&key) ;
            if (pValue != NULL)
            {
                pRC = pValue->getValue() ;                
                destroy(&key) ;
            }

            if (pCount)
            {
                mLockCountHash.destroy(&UtlInt(handle));
            }
        }
    
        unlock() ;
    }

    return pRC ;
}
Example #2
0
const void* SipXHandleMap::removeHandle(SIPXHANDLE handle) 
{
    lock() ;

    releaseHandleRef(handle);
    const void* pRC = NULL ;
    UtlInt key(handle) ;
        
    UtlInt* pCount = static_cast<UtlInt*>(mLockCountHash.findValue(&key)) ;
        
    if (pCount == NULL || pCount->getValue() < 1)
    {
        UtlVoidPtr* pValue ;
            
        pValue = (UtlVoidPtr*) findValue(&key) ;
        if (pValue != NULL)
        {
            pRC = pValue->getValue() ;                
            if(! destroy(&key))
            {
                OsSysLog::add(FAC_SIPXTAPI, PRI_ERR,
                        "SipXHandleMap::removeHandle failed to destroy handle: %d",
                        handle);
            }
        }

        if (pCount)
        {
            if(! mLockCountHash.destroy(&key))
            {
                OsSysLog::add(FAC_SIPXTAPI, PRI_ERR,
                        "SipXHandleMap::removeHandle failed to destroy lock count for handle: %d",
                        handle);
            }
        }
    }
    
    unlock() ;
    return pRC ;
}