Why Mutex Cannot Be Exempted from ISR

Vxworks claims that mutual exclusion semaphores: cannot be specified inside the ISR, while the condition is vaild for the binary and counting semaphore.

I can not understand the reason for the same.

Thanks, Sachs.

+3
source share
1 answer

Remember that Mutex must first be received / received , then released / set. In addition, the task that gets the mutex belongs . This prevents the release of another task from the mutex to which it does not belong.

, , ISR ( - ), , .

ISR , , - . take/give.

. VxWorks ISR !
:

  Task A            ISR
  semTake(mutex)
   ....
                    semGive(mutex)

A . ISR , . ISR. A , ISR ? , , ISR , A .
, "" ISR, :

 Task A                       Task B                 ISR
  semTake(mutex)
  ...
  <context switch happens>
                              <B runs>
                                                  semGive(mutex)

A - , , B. ISR B. ISR?

, , Get/Set. , semGive.

, semGive ISR?

+8

Source: https://habr.com/ru/post/1778110/


All Articles