marcabramson wrote on Friday, November 06, 2015:
my code blocks in the line
for( pxIterator = ( ListItem_t * ) &( pxList->xListEnd ); pxIterator->pxNext->xItemValue <= xValueOfInsertion; pxIterator = pxIterator->pxNext ) /lint !e826 !e740 The mini list structure is used as the list end to save RAM. This is checked and valid. /
/&(nu_itemuxNumberOfItems) /); pxIterator = pxIterator->pxNext ) /*lint !e826 !e740 The mini list structure is used as the list end to save RAM. This is checked and valid. */
of vListInsert funciton .
I HAVE read carefully the comment and:
-I’m nor using Cortex M3
- I’m not using interrupt (except the timer interrupt for the context switch) so the functionFromIsr don’t need to be called
- I have checked the stack overflow
- I’m not using a queue or semaphore before it has been initialised or before the scheduler has been started
What I have is
-3 task, with the same priority
- one of them waiting with a vTaskDelay
- one of them waiting for a semaphore
anyway looking to the following comment in the code
/* However, if the xItemValue is the same as the back marker
the iteration loop below will not end. Therefore the value is checked
first, and the algorithm slightly modified if necessary. */
I can see that I’m in this case
But I can also not the see how this case is handled in the code, and how the algoirhm is sliglty modified.
So, I did the following modification, replacing
if( xValueOfInsertion == portMAXDELAY )
{
pxIterator = pxList->xListEnd.pxPrevious;
}
by
pxIterator= ( ListItemt ) &( pxList->xListEnd );
if ((xValueOfInsertion == portMAXDELAY ) || (xValueOfInsertion== pxIterator->pxNext->xItemValue))
{
pxIterator = pxList->xListEnd.pxPrevious;
}
which does correspond (in my opinion) to the comment. Value of the back Marker is now compared first to the xitemValue
and after that, everything works 100% fine.
Any comment ?