sei
) and enabling them after the critical section. In general, this method assumes the processor accepts interrupts when lock()
is called. This strategy is not suitable to implement functions that will be called with interrupts masked because this will create a side-effect: enable interrupts.
Example:
lock (); ... unlock ();
Example:
unsigned short mask;
mask = lock (); ... restore (mask);
Sometimes it is necessary to allow interrupt processing again to make sure interrupts are not masked for a too long period. In this case, unlocking and relocking interrupts afterwards allows this. The function interruption_point
is defined for this.