Example #1
0
Int32 System_ipcListMPClose(ListMP_Handle *pOutHndl, ListMP_Handle *pInHndl)
{
    Int32 status;

    status = ListMP_close(pOutHndl);
    UTILS_assert(status==ListMP_S_SUCCESS);

    status = ListMP_close(pInHndl);
    UTILS_assert(status==ListMP_S_SUCCESS);

    return status;
}
Example #2
0
/*
 *  ======== SemaphoreMP_Instance_finalize ========
 */
Void SemaphoreMP_Instance_finalize(SemaphoreMP_Object *obj, Int status)
{
    if (obj->objType & (ti_sdo_ipc_Ipc_ObjType_CREATEDYNAMIC |
                        ti_sdo_ipc_Ipc_ObjType_CREATEDYNAMIC_REGION)) {
        /* SemaphoreMP is being deleted */
        /* Remove entry from NameServer */
        if (obj->nsKey != NULL) {
            NameServer_removeEntry((NameServer_Handle)
                    SemaphoreMP_module->nameServer, obj->nsKey);
        }

        /* Set status to 'not created' */
        obj->attrs->status = 0;
        if (obj->cacheEnabled) {
            Cache_wbInv(obj->attrs, sizeof(SemaphoreMP_Attrs), 
                    Cache_Type_ALL, TRUE);
        }

        /* Delete the pendQ. If NULL, then ListMP_create failed. */
        if (obj->pendQ != NULL) {
            ListMP_delete((ListMP_Handle *)&(obj->pendQ));
        }

        /*
         *  Free the shared memory back to the region SemaphoreMP. If NULL, then
         *  the Memory_alloc failed.
         */
        if (obj->objType == ti_sdo_ipc_Ipc_ObjType_CREATEDYNAMIC_REGION &&
            obj->attrs != NULL) {
            Memory_free(SharedRegion_getHeap(obj->regionId), obj->attrs, 
                    obj->allocSize);
        }
    }
    else {
        /* SemaphoreMP is being closed */
        /* Close the pendQ. If NULL, then ListMP_openByAddr failed. */
        if (obj->pendQ != NULL) {
            ListMP_close((ListMP_Handle *)&(obj->pendQ));
        }
        
        /* Close the gate. If NULL, then GateMP_openByAddr failed. */
        if (obj->gate != NULL) {
            GateMP_close((GateMP_Handle *)&(obj->gate));
        }
    }
}
Example #3
0
/*
 *  ======== TransportShm_Instance_finalize ========
 */
Void TransportShm_Instance_finalize(TransportShm_Object* obj, Int status)
{
    Swi_Handle     swiHandle;

    if (obj->objType == ti_sdo_ipc_Ipc_ObjType_CREATEDYNAMIC) {
        /* clear the self flag */
        obj->self->flag = 0;

        if (obj->cacheEnabled) {
            Cache_wbInv(&(obj->self->flag),
                SharedRegion_getCacheLineSize(obj->regionId), Cache_Type_ALL,
                    TRUE);
        }

        if (obj->localList != NULL) {
            ListMP_delete((ListMP_Handle *)&(obj->localList));
        }

        if (obj->remoteList != NULL) {
            ListMP_delete((ListMP_Handle *)&(obj->remoteList));
        }
    }
    else {
        /* other flag was set by remote proc */
        obj->other->flag = 0;

        if (obj->cacheEnabled) {
            Cache_wbInv(&(obj->other->flag),
                SharedRegion_getCacheLineSize(obj->regionId), Cache_Type_ALL,
                    TRUE);
        }

        if (obj->gate != NULL) {
            GateMP_close((GateMP_Handle *)&(obj->gate));
        }

        if (obj->localList != NULL) {
            ListMP_close((ListMP_Handle *)&(obj->localList));
        }

        if (obj->remoteList != NULL) {
            ListMP_close((ListMP_Handle *)&(obj->remoteList));
        }
    }

    switch(status) {
        case 0:
            /* MessageQ_registerTransport succeeded */
            ti_sdo_ipc_MessageQ_unregisterTransport(obj->remoteProcId, obj->priority);
            /* OK to fall through */
        case 1: /* GateMP open failed */
        case 2: /* ListMP create/open failed */
        case 3: /* Notify_registerEventSingle failed */
        case 4: /* MessageQ_registerTransport failed */
            Notify_unregisterEventSingle(
                obj->remoteProcId,
                0,
                TransportShm_notifyEventId);
            break;
    }

    /* Destruct the swi */
    swiHandle = TransportShm_Instance_State_swiObj(obj);
    if (swiHandle != NULL) {
        Swi_destruct(Swi_struct(swiHandle));
    }
}