Delay or Timeout by semaphore

delphes wrote on Sunday, March 25, 2018:

Dear All,

it is a kind of strange question, I am agree, anyway. I have a complex FreeRTOS project and somewhere I have to wait 30 ms, of course there is vTaskdekay(30) (assuming 1ms is the tick) but there is also xSemaphoreTake(NeverUsedSemaphore,30); assuming this semaphore is never release nor acquired just created, so it will exit by timeout.
In terms of context switch or whatever what is the better way Taskdelay or semaphore wait ?


richard_damon wrote on Sunday, March 25, 2018:

I would use the vTaskDelay call instead of taking a semaphore that is never given, mostly because it is clearer what you are doing.