anonymous wrote on Thursday, May 01, 2008:
Unintentionally my system blocked on a receive after calling vTaskSuspendAll(). It is unclear to me what the intended FreeRTOS behaviour is, but the behaviour I observed seems to be a FreeRTOS bug.
In xQueueGenericReceive(), the following code is executed after the calling task is enqueued on the xTasksWaitingToReceive list.
if( !xTaskResumeAll() )
However, taskYield() does not re-schedule because scheduling is suspended. The calling task continues, ultimately hitting the end of the do-while with xReturn==queueERRONEOUS_UNBLOCK. Another iteration is performed, once again performing
vTaskPlaceOnEventList( &( pxQueue->xTasksWaitingToReceive ), xTicksToWait );
But this call corrupts the list, presumably because the item is already on the list. In my case of only the one item on the list, it is corrupted such that xListEnd locates the list item, but the list item locates itself rather than xListEnd. The next search of the list becomes an infinite loop on
for( pxIterator = ( xListItem * ) &( pxList->xListEnd )
____; pxIterator->pxNext->xItemValue <= xValueOfInsertion
____; pxIterator = pxIterator->pxNext )
in vListInsert() on the next do-while iteration.