void vTaskDisplay( void * pvParameters )
{
while(1)
{
// Queue receive, wait 10
if( xQueueReceive( displayQueue, &cmd, ( TickType_t ) 10 ) == pdPASS )
{
if (SHOW == cmd) {
printf("db 1 - begin\n");
xSemaphoreTake(s_lock, portMAX_DELAY);
flash_db_operation();
xSemaphoreGive(s_lock);
printf("db 1 - end\n");
}
}
printf("display_tick()\n");
display_tick();
}
}
I have the simplified my code, but is does basically as the code above.
My expected outcome would be:
db 1 - begin
db 1 - end
display_tick()
But sometimes I see:
db 1 - begin
display_tick()
display_tick()
db 1 - end
So it seems like the task is waiting for the semaphore, but then runs again.
Maybe I have totally misunderstood something, but I would expect the task to be blocked, until the semaphore is given. It is like the task is fork’ed or something.