Now that you've attached an interrupt

At this point, you've called either InterruptAttachEvent() or InterruptAttach().

Note: Since attaching an interrupt isn't something you want everyone to be able to do, QNX Neutrino allows only threads that have “I/O privileges” enabled to do it (see the ThreadCtl() function in the QNX Neutrino C Library Reference). Only threads that have the PROCMGR_AID_IO ability enabled (see procmgr_ability()) can obtain “I/O privileges”; hence we're effectively limiting this ability to root. Threads must also have the PROCMGR_AID_INTERRUPT ability enabled.

Here's a code snippet that attaches an ISR to the hardware interrupt vector, which we've identified in our code sample by the constant HW_SERIAL_IRQ:

#include <sys/neutrino.h>

int interruptID;

const struct sigevent *
intHandler (void *arg, int id)

main (int argc, char **argv)
    interruptID = InterruptAttach (HW_SERIAL_IRQ, 
                                   sizeof (event), 
    if (interruptID == -1) {
        fprintf (stderr, "%s:  can't attach to IRQ %d\n",  
                 progname, HW_SERIAL_IRQ);
        perror (NULL);
        exit (EXIT_FAILURE);
    return (EXIT_SUCCESS);

This creates the association between the ISR (the routine called intHandler(); see below for details) and the hardware interrupt vector HW_SERIAL_IRQ.

At this point, if an interrupt occurs on that interrupt vector, our ISR will be dispatched. When we call InterruptAttach(), the kernel unmasks the interrupt source at the PIC level (unless it's already unmasked, which would be the case if multiple ISRs were sharing the same interrupt).