nobody wrote on Friday, November 10, 2006:
These effectively do the same thing.
The idea is not to nest calls. In other words if you call:
interrupts are not reenabled until the second call to portEXIT_CRITICAL().
The GCC port does this by pushing the status flags onto the stack within each call to portENTER_CRITICAL(). A second or third call to portENTER_CRITICAL() will already have interrupts disabled when the flags are pushed, so popping the flags will not re enable interrupts again until the first push is popped.
The IAR port simply keeps a count of the number of time portENTER_CRITICAL() is called, and does not re-enable interrupts until the count reaches zero. The count has to be stored as part of the task context as each task has its own count.