void dvtb_audDec1SemClose(SemThread_Handle *sem_in, SemThread_Handle *sem_out, SemThread_Handle *sem_block) { SemThread_delete(sem_in); SemThread_delete(sem_out); SemThread_delete(sem_block); }
/* ARGSUSED */ Void smain(UArg arg0, UArg arg1) { SemThread_Params semParams; Task_Params taskParams; Task_Handle tsk; Int i; Log_print0(Diags_ENTRY, "[+E] smain> Enter "); SemThread_Params_init(&semParams); done = SemThread_create(0, &semParams, NULL); SemThread_Params_init(&semParams); mutex = SemThread_create(1, &semParams, NULL); if ((done == NULL) || (mutex == NULL)) { Log_print0(Diags_USER7, "[+7] smain> SemThread creation failed"); System_abort("SemThread_create failed \n"); } Task_Params_init(&taskParams); /* * Add the following line to have the stack allocated from the external * heap: * taskParams.stackHeap = (IHeap_Handle)EXTMEM_HEAP; */ taskParams.stackSize = 0x1000; for (i = 0; i < NUMTASKS; i++) { Task_Params_init(&taskParams); taskParams.priority = attrsTable[i].priority; taskParams.arg0 = i + 1; /* task id */ taskParams.arg1 = i; /* index into attrsTable */ tsk = Task_create((Task_FuncPtr)rmanTask, &taskParams, NULL); if (tsk == NULL) { Log_print1(Diags_USER7, "[+7] smain> Task_create of task %d failed", (IArg)(i + 1)); System_abort("Task_create() failed\n"); } } for (i = 0; i < NUMTASKS; i++) { SemThread_pend(done, SemThread_FOREVER, NULL); } SemThread_delete(&mutex); SemThread_delete(&done); Log_print0(Diags_USER4, "[+4] smain> TEST PASSED "); Log_print0(Diags_EXIT, "[+X] smain> Exit "); }
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); }
/* * ======== cleanup ======== */ static Void cleanup(Void) { static CmdObj dcmdInit = {NULL, NULL, NONE, NONE, NULL, NULL, NULL}; if (curInit != FALSE) { curInit = FALSE; if (dcmd.dproc != NULL) { doCmd(EXIT, NULL); // Thread_join(dcmd.dproc); Thread_delete(&dcmd.dproc); /* will do join first? */ dcmd.dproc = NULL; } Log_print0(Diags_USER2, "[+2] Processor cleanup()> " "SysLink_destroy()..."); SysLink_destroy(); Log_print0(Diags_USER2, "[+2] Processor cleanup()> " "... SysLink_destroy() complete"); if (dcmd.cmdPresent != NULL) { SemThread_delete(&dcmd.cmdPresent); dcmd.cmdPresent = NULL; } if (dcmd.replyPresent != NULL) { SemThread_delete(&dcmd.replyPresent); dcmd.replyPresent = NULL; } if (dcmd.gate != NULL) { GateThread_delete(&dcmd.gate); dcmd.gate = NULL; } dcmd = dcmdInit; } }
/* ARGSUSED */ Void SyncSemThread_Instance_finalize(SyncSemThread_Object *obj, Int status) { if (obj->semThread != NULL) { SemThread_delete(&obj->semThread); } }