# OS_WaitIrq

## C Specification

      #include <nitro/os.h>

      void OS_WaitIrq(
              BOOL        clear ,
              OSIrqMask   irqFlags );

## Description

This function waits for the generation of a specified IRQ interrupt.

In `irqFlags` you can specify multiple interrupt sources by logical OR-ing the mask values. Generation of any of the interrupts included here will cause a return from the function.

If a check flag is set after an IRQ interrupt is generated, that indicates an IRQ interrupt has occurred. To set this flag, the user must explicitly call `OS_SetIrqCheckFlag()` from the interrupt handler.

If you set `clear` to TRUE, before waiting, from amongst the interrupt check flags, this resets the interrupt flags that are specified by `irqFlags`. If a relevant check flag has been preset, and there are no flags to reset, return from the function will be immediate.

The difference between `OS_WaitInterrupt()` and `OS_WaitIrq()` is this:

- While `OS_WaitInterrupt()` is waiting for an interrupt, it it uses `OS_Halt()` to stop.
- While `OS_WaitIrq()` is waiting for an interrupt, it switches processing to another thread. It restarts operation after an interrupt is generated.

If no threads are used, both functions behave the same.

## Arguments

`clear` | Whether to clear check flags
`irqFlags` | The mask value of the interrupt generation that the function is waiting for. You can specify more than one using a logical OR.

## Return Values

None

## See Also

`OS_SetIrqCheckFlag()`, `OS_WaitInterrupt`

## Revision History

05/24/2004 Clarified the difference between this function and `OS_WaitInterrupt`
05/01/2004 Initial version