Notifying the application code

Since the environment the ISR operates in is very limited, generally you'll want to perform most (if not all) of your actual servicing operations at the thread level.

At this point, you have two choices:

  • You may decide that some time-critical functionality needs to be done in the ISR, with a thread being scheduled later to do the real work.
  • You may decide that nothing needs to be done in the ISR; you just want to schedule a thread.

This is effectively the difference between InterruptAttach() (where an ISR is attached to the IRQ) and InterruptAttachEvent() (where a struct sigevent is bound to the IRQ).

Let's take a look at the prototype for an ISR function and the InterruptAttach() and InterruptAttachEvent() functions:

int
InterruptAttach (int intr,
                 const struct sigevent * (*handler) (void *, int),
                 const void *area,
                 int size,
                 unsigned flags);

int
InterruptAttachEvent (int intr,
                      const struct sigevent *event,
                      unsigned flags);

const struct sigevent *
handler (void *area, int id);
Page updated: