Here is an extract of the FreeRTOS api-reference http://www.freertos.org/a00122.html regarding the xSemaphoreTake() function:
// See if we can obtain the semaphore. If the semaphore is not available
// wait 10 ticks to see if it becomes free.
if( xSemaphoreTake( xSemaphore, ( portTickType ) 10 ) == pdTRUE )
{
// We were able to obtain the semaphore and can now access the
// shared resource.
My question is: Do i already have the semaphore here or do i have to call
xSemaphoreTake( xSemaphore, (portTickType) 10 )
explicit like:
// We have finished accessing the shared resource. Release the
// semaphore.
xSemaphoreGive( xSemaphore );
}
As of the example you link to, within the if (...) body the semaphore is taken. If you're copy-pasting from that example, it's up to you to ensure that you have both xSemaphoreTake and xSemaphoreGive in your program.