This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Interrupt Service Routine (ISR) and os_mut_wait()

When ISR calls os_mut_wait() the processor generates an exception.

Is os_mut_wait() prohibited from being called from an ISR?

Parents
  • The "good" way is to use a ring buffer, where the ISR (producer) owns the write pointer and the main program (consumer) owns the read pointer.

    Suddenly, you don't need any locking mechanisms unless your processor isn't able to perform atomic writes of the pointers.

    You may decide to degenerate the ring buffer into a double-buffered approach too if you want.

    But the ISR may never wait. It must always be able to go ahead - or must be delayed a clock cycle or two from entering - or must fail.

Reply
  • The "good" way is to use a ring buffer, where the ISR (producer) owns the write pointer and the main program (consumer) owns the read pointer.

    Suddenly, you don't need any locking mechanisms unless your processor isn't able to perform atomic writes of the pointers.

    You may decide to degenerate the ring buffer into a double-buffered approach too if you want.

    But the ISR may never wait. It must always be able to go ahead - or must be delayed a clock cycle or two from entering - or must fail.

Children