/* * ======== 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; } }
Int RcmClient_Instance_finalize(RcmClient_Object *obj) { SemThread_Handle semH; Int status = RcmClient_S_SUCCESS; Log_print1(Diags_ENTRY, "--> "FXNN": (obj=0x%x)", (IArg)obj); if (NULL != obj->newMail) { List_delete(&obj->newMail); } if (NULL != obj->recipients) { List_delete(&obj->recipients); } if (NULL != obj->queueLock) { semH = SemThread_Handle_downCast(obj->queueLock); SemThread_delete(&semH); obj->queueLock = NULL; } if (NULL != obj->mbxLock) { semH = SemThread_Handle_downCast(obj->mbxLock); SemThread_delete(&semH); obj->mbxLock = NULL; } if (MessageQ_INVALIDMESSAGEQ != obj->serverMsgQ) { MessageQ_close((MessageQ_QueueId *)(&obj->serverMsgQ)); } if (NULL != obj->errorMsgQue) { MessageQ_delete(&obj->errorMsgQue); } if (NULL != obj->msgQue) { MessageQ_delete(&obj->msgQue); } if (NULL != obj->sync) { SyncSemThread_delete((SyncSemThread_Handle *)(&obj->sync)); } /* destruct the instance gate */ GateThread_destruct(&obj->gate); Log_print1(Diags_EXIT, "<-- "FXNN": %d", (IArg)status); return(status); }
/* * ======== 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; }; }