Example #1
0
/*
 *  ======== GIO_Instance_finalize ========
 */
Void GIO_Instance_finalize(GIO_Object *obj, Int status)
{    
    Queue_Handle            freeList;
    SyncSemThread_Handle    sync;
    IOM_Fxns                *iomFxns;

    iomFxns = (IOM_Fxns *)obj->fxns;

    /* fall through in switch below is intentional */
    switch (status) {
        case 0:        
            /* GIO_delete() */
            if (obj->submitCount > 0) {
                GIO_flush(obj);
            }
            iomFxns->mdDeleteChan(obj->mdChan);

            /* OK to fall through */                 

        case 4:
            /* mdCreateChan failed */

            /* OK to fall through */                 

        case 3:
            /* name not found */
            Memory_free(NULL, obj->packets, 
                sizeof(IOM_Packet) * obj->numPackets);

            /* OK to fall through */                 
        
        case 2:
            /* alloc packets failed */
            freeList = GIO_Instance_State_freeList(obj);
            Queue_destruct(Queue_struct(freeList));
            
            if (obj->userSync == FALSE) {
                sync = SyncSemThread_Handle_downCast(obj->sync);
                SyncSemThread_delete(&sync);
            }

            /* OK to fall through */                 

        case 1:
            /* Sync_create failed */

            /* OK to fall through */                 

        default:
            break;
    }
}
Example #2
0
/*
 *  ======== Stream_Instance_finalize ========
 */
Void Stream_Instance_finalize(Stream_Object *obj, Int status)
{    
    List_Handle freeList;
    SyncSemThread_Handle tempSyncHdl;

    Assert_isTrue((obj->issued == 0), Stream_A_pendingReclaims);

    /* fall through in switch below is intentional */
    switch (status) {
        /* Stream_delete() */
        case 0:        
            IConverter_close(obj->convHandle, NULL);
                
        /* IConverter_open failed */
        case 5:
           if (obj->drvAdapHdl == TRUE) {
               IConverter_delete(&obj->convHandle);
           }
               
        /* DriverAdapter create failed */
        case 4:
        
        /* name not found */
        case 3:
            Memory_free(obj->packetHeap, obj->packets, 
            sizeof(DriverTypes_Packet) * obj->maxIssues);
        
        /* alloc packets failed */
        case 2:
            
            freeList = Stream_Instance_State_freeList(obj);
            List_destruct(List_struct(freeList));
            
            if (obj->userSync == FALSE) {
                tempSyncHdl = SyncSemThread_Handle_downCast(obj->complete);
                SyncSemThread_delete(&tempSyncHdl);
            }

        /* Sync_create failed */
        case 1:

        default:
            break;
    };

}