# OS_WaitInterrupt

## Syntax

  `#include <nitro/os.h>`
  `void OS_WaitInterrupt( BOOL clear, OSIrqMask irqFlags );`

## Arguments

clear | Indicates whether check flags should be cleared.
irqFlags | The mask value of the interrupt generation for which the function is waiting. You can specify more than one by using a logical sum.

## Return Values

None.

## Description

Waits for the generation of a specified IRQ interrupt cause.

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. Refer to the following information for the types of interrupts.

Types of Interrupts

> `(Example) Waits for either VBLANK or TIMER0.`
> `OS_WaitInterrupt( TRUE, OS_IE_V_BLANK | OS_IE_TIMER0 );`

To determine if an interrupt occurred, examine whether the interrupt check flag has been set. To set this flag, the user must explicitly call `OS_SetIrqCheckFlag` from the interrupt handler.

If clear is set to `TRUE`, the interrupt check flags specified in irqFlags will be reset before waiting for the interrupt to occur. If FALSE, they will not be reset. If they are not reset, and the check flag you want to wait on is set when this function is reached, control will return from this function immediately.

###
Differences Between `OS_WaitInterrupt()` and `OS_WaitIrq()`

The difference between `OS_WaitInterrupt()` and `OS_WaitIrq()` is this: While `OS_WaitInterrupt()` is waiting for an interrupt cause, it uses `OS_Halt()` to stop. While `OS_WaitIrq()` is waiting for an interrupt cause, it switches processing to another thread. It restarts operation after an interrupt is generated. If no threads are used, both functions behave the same.

## See Also

`OS_SetIrqCheckFlag`, `OS_WaitIrq`

## Revision History

2005/03/08 Standardized the Japanese term for "interrupt."
2004/05/24 Initial version.

CONFIDENTIAL