When setting OS_CFG_ISR_POST_DEFERRED_EN
to 1, µC/OS-III locks the scheduler before entering a critical section and unlocks the scheduler when leaving the critical section.
OS_CRITICAL_ENTER()
simply increments OSSchedLockNestingCtr
to lock the scheduler. This is the variable the scheduler uses to determine whether or not the scheduler is locked. It is locked when the value is non-zero.
OS_CRITICAL_EXIT()
decrements OSSchedLockNestingCtr
and when the value reaches zero, invokes the scheduler.
OS_CRITICAL_EXIT_NO_SCHED()
also decrements OSSchedLockNestingCtr
, but does not invoke the scheduler when the value reaches zero.
The code for the macros is shown in Listing 4-2.