InterruptDisable()

Updated: May 06, 2022

Disable hardware interrupts

Synopsis:

#include <sys/neutrino.h>

void InterruptDisable( void );

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The InterruptDisable() function disables all hardware interrupts. You can call it from a thread or from an interrupt handler. Before calling this function:

If you don't do these things, the thread might SIGSEGV when it calls InterruptDisable().

Reenable the interrupts by calling InterruptEnable().

Use InterruptDisable() instead of an inline cli to ensure hardware portability with non-x86 CPUs.

CAUTION:
  • You should disable interrupts for as little time as possible (i.e., the minimum time you need to access or deal with the hardware). Failure to do so may result in increased interrupt latency and the inability to meet realtime deadlines.
  • Some kernel calls and library routines reenable interrupts. Masked interrupts aren't affected.
  • Use InterruptLock() and InterruptUnlock() instead of InterruptDisable() and InterruptEnable(). The InterruptLock() and InterruptUnlock() functions perform the intended function on SMP hardware, and allow your interrupt thread to run on any processor in the system.
  • InterruptDisable() doesn't support nesting. If a specific thread calls this function once and then calls it again without having reenabled hardware interrupts, the second call has no effect, and the first InterruptEnable() call after this point reenables hardware interrupts.

Classification:

QNX Neutrino

Safety:  
Cancellation point No
Interrupt handler Yes
Signal handler Yes
Thread Yes