/* * ======== NODE_delete ======== */ Int NODE_delete(NODE_Handle node) { Void *handle; /* Should be a DBC_requires */ Assert_isTrue(node != NULL, (Assert_Id)NULL); Assert_isTrue(node->skelFxns != NULL, (Assert_Id)NULL); Assert_isTrue(node->skelFxns->apiDestroy != NULL, (Assert_Id)NULL); /* delete thread *before* destroying node to ensure thread has no access * to node as we are freeing it */ if (node->self) { Log_print1(Diags_ENTRY, "[+E] NODE_delete(0x%x)", (IArg)node); Thread_delete(&(node->self)); } handle = NODE_getEnv(node); if (handle) { node->skelFxns->apiDestroy(handle); } if (node->recv != Comm_INVALIDHANDLE) { Comm_delete(node->recv); } Memory_free(NULL, node, sizeof(NODE_Obj)); return (NODE_EOK); }
/* * ======== 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; } if (dcmd.cmdPresent != NULL) { Sem_delete(dcmd.cmdPresent); dcmd.cmdPresent = NULL; } if (dcmd.replyPresent != NULL) { Sem_delete(dcmd.replyPresent); dcmd.replyPresent = NULL; } if (dcmd.gate != NULL) { Lock_delete(dcmd.gate); dcmd.gate = NULL; } dcmd = dcmdInit; } }
/* * ======== 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; } }