nobody wrote on Tuesday, February 14, 2006:
I’m having a problem that I’ve traced to xSemaphoreTake returning failure right away, despite the fact that the semaphore is initialized properly and I tell it to block a long time.
The weird thing is that the following code works:
while(xSemaphoreTake(sem, portMAX_DELAY) != pdTRUE)
; //do nothing
but this code occasionally returns failure right away:
It seems like a race condition because it only fails once in a while, at unpredictable times.
I’m using this semaphore as a lock on a data structure. The problem only occurs when I have another task running that receives frequently (faster than 1000Hz) on a different queue. The messages on the different queue are posted from an ISR with xQueueSendFromISR.