#include <rtl_sync.h>
void rtl_no_interrupts(rtl_irqstate_t state);
void rtl_restore_interrupts(rtl_irqstate_t state);
void rtl_stop_interrupts();
void rtl_allow_interrupts();
|
These functions are non-portable Realtime Linux extensions.
rtl_no_interrupts saves the current state of the processor interrupt flags in the variable state and then disables the interrupts on this processor.
rtl_restore_interrupts is defined as a macro. It uses its argument to restore the interrupt state previously saved with rtl_no_interrupts.
rtl_stop_interrupts disables the interrupts.
rtl_allow_interrupts enables the interrupts.
The following example demonstrates a typical usage.
{
rtl_irqstate_t irqstate;
rtl_no_interrupts(irqstate);
/* this code runs with interrupts disabled! */
rtl_restore_interrupts(irqstate);
/* interrupt state is back to what it was before */
} |
These functions only affect the interrupt flags of the current processor.
Be sure to disable hardware interrupts for short periods of time only. Do not enable interrupts in a hard signal/interrupt handler unless you really know what you are doing.
©2001 FSMLabs Inc.
All rights reserved.