INscope – interrupt example

A quick reminder that interrupt handler code after SignalRtInterruptThread will not run until the associated interrupt thread finished. This situation is often not considered by developers because they know that an interrupt handler will always interrupt any code currently executing.
INscope clearly shows what happens in such situations.
 
  • The interrupt handler interrupts the thread named “work-5718”. The interrupt handler now executes in the context of “work-5718”. This is indicated by the grey bars in the timeline. When the interrupt handler calls SignalRtInterruptThread it returns control to INtime and the interrupt thread that had been in state “asleep” by calling WaitForRtInterrupt gets “ready” - with its high priority.
  • The high priority interrupt thread gets scheduled by INtime. First event captured thus is the “EXIT:      WaitForRtInterrupt” when returning from the call to WaitForRtInterrupt. Once the interrupt thread is done it calls WaitForRtInterrupt again. This call puts the “ENTER:  WaitForRtInterrupt” into the trace and the interrupt thread transitions into state “asleep” now waiting for the next interrupt signaled by the interrupt handler.
  • The interrupted thread “work-5718” is scheduled again by INtime allowing the remaining code of the interrupt handler to run to completion