xTaskRemoveFromEventList usage

nobody wrote on Thursday, February 01, 2007:

Im trying to implement a counting semaphore.

typedef struct SemaphoreDefinition {
    int     count;
    xList    xTasksWaitingToTake;
}xSEMAPHORE ;

in my SemaphoreGive() ,
i need to extract highest priority task from xTasksWaitingToTake list

does xTaskRemoveFromEventList(xTasksWaitingToTake) really remove highest priority task from my semaphore event list, remove it from delayed/overflow delayed list and put it in ready list?

I just cant find an example of it in FreeRTOS itself. xQueueSend/Receive doesnt seem to be using this function.

embeddedc wrote on Thursday, February 01, 2007:

xTaskRemoveFromEventList is used from queue.c.  The normal way to implement a counting semaphore is to use a queue in the same way that the binary semaphore does, but with more than one space on the queue.  No data is actually queued as the data size is set to zero.

nobody wrote on Thursday, February 01, 2007:

yeah, but I am supposed to do some study of difference between semaphore with dedicated structure, and semaphore using queue structure like FreeRTOS’s.

does FreeRTOS provide facility to extract highest priority task from event list?

embeddedc wrote on Thursday, February 01, 2007:

This is done automatically within xTaskRemoveFromEventList.