Whenever there is a critical section
(CS
) that can be run in interrupt context
, you use a spinlock
to protect it, it does not matter if the CS
is shared between interrupt handler
and a process
or between interrupt handlers
.
The reson why you do not use semaphore
or mutex
is obvious, because you can't sleep in interrupt context
.