Just a quick question, does it possible to delete semaphore inside task ? my code is working but not quite sure it is safe ? does the semaphore need to be deleted after the Vtask delete (see my code following)
void myTask(void const* pArgument)
{
for (; {
osSemaphoreWait(xSemaphore, osWaitForever);
// do some actions
vSemaphoreDelete(xSemaphore);
vTaskDelete(NULL);
}
}
One other comment, putting the vSemaphoreDelete after the call to vTaskDelete(NULL) wouldn’t work, as a call to vTaskDelete(NULL) won’t return, as the calling task no longer exists. It is sort of the the task equivalent to exit() (for that particular task).