I have some doubts, please forgive trivial question.
from documentation about taskENTER_CRITICAL()
"Macro to mark the start of a critical code region. Preemptive context switches cannot occur when in a critical region."
We disable interrupts but other type of context switch can still happened(?)
lets consider that code, aim is protect variable "protectedVar":
protectedVar = something;
if( xQueueSendToBack( xQueue1,&ulVar,10 ) != pdPASS )
something2 = protectedVar+2; // in this line var protectedVar could be corrupted because xQueueSendToBack() could cause context switch
send message to other task with higher priority could cause context switch anyway, I have tested it on port PIC24.
My questions is:
1. Is it desirable feature of port what I use? in other words is my example code wrong from definition?
2. If answer on 1 is Yes, so is only cause why freeRTOS maintain separate uxCriticalNesting value for every task or maybe there are any other reasons?