void osDeleteEvent(OsEvent *event) { //Make sure the operating system is running if(OS_IsRunning()) { //Properly dispose the event object OS_EVENT_Delete(event); } }
/********************************************************************* * * IP_OS_WaitItemTimed() * * Function description * Suspend a task which needs to wait for a object. * This object is identified by a pointer to it and can be of any type, e.g. socket. * * Context * Function is called from an application task. */ void IP_OS_WaitItemTimed(void * pWaitItem, unsigned Timeout) { TCP_WAIT TCPWait; // // Create the wait object which contains the OS-Event object // TCPWait.pPrev = NULL; TCPWait.pWaitItem = pWaitItem; OS_EVENT_Create(&TCPWait.Event); // // Add to doubly-linked list with temp. disabled interrupts // IP_OS_DisableInterrupt(); TCPWait.pNext = _pTCPWait; _pTCPWait = &TCPWait; if (TCPWait.pNext) { TCPWait.pNext->pPrev = &TCPWait; } IP_OS_EnableInterrupt(); // // Unlock mutex and suspend this task // IP_OS_Unlock(); if (Timeout == 0) { OS_EVENT_Wait(&TCPWait.Event); } else { OS_EVENT_WaitTimed(&TCPWait.Event, Timeout); } // // Remove it from doubly linked list with temp. disabled interrupts // IP_OS_DisableInterrupt(); if (TCPWait.pPrev) { TCPWait.pPrev->pNext = TCPWait.pNext; } else { _pTCPWait = TCPWait.pNext; } if (TCPWait.pNext) { TCPWait.pNext->pPrev = TCPWait.pPrev; } IP_OS_EnableInterrupt(); // // Delete the event object & lock the mutex again // OS_EVENT_Delete(&TCPWait.Event); IP_OS_Lock(); }