0

is it possible for an ISR to occur during mutex task is running, actually what I want to know is whether mutex task or ISR has the higher priority?

user2995743
  • 99
  • 1
  • 4

1 Answers1

0

This depends entirely on the OS and the mutex implementation. Typical mutex APIs contain a trylock(). There are versions of trylock() which can be used in an interrupt service routine (ISR). However, as an ISR services hardware and they must always execute. There is no way to block the execution with a mutex. Instead, the hardware can be turned off so there are no interrupts or interrupts can be masked. Masking the interrupts is frond upon as it will increase interrupt latency; Ie, you can cause hardware issues.

It is a really bad idea for a general user task to block all system interrupts. If this is what you wish, you probably have an issue with your design.

Community
  • 1
  • 1
artless noise
  • 21,212
  • 6
  • 68
  • 105