# KIO's Thread Dispatcher - Documentation

## Interrupts

### Overview

void Clear ( Irpt& i ) clear interrupt This clears the interrupt. The next time it is triggered, it will yield an interrupt, resuming all threads which are sheduled for it. For simple tasks you will trigger interrupts always once and use this call to clear it. Clear() does not perform a dispatcher test! void Clear ( Irpt& i, int n ) clear n interrupts Interrupts can count, you can trigger them multiple times and with this call you can clear a precise number of interrupts from this cell. If there were more interrupts pending, the cell may remain triggered, and sheduling a thread for it will immediately resume it. Otherwise you may have to trigger it propably more than once to make it fire. If you need to keep track of the exact amount of interrupts you will probably use this call to clear them. Clear() does not perform a dispatcher test! void Trigger ( Irpt& i, int n=1 ) trigger an interrupt void AsyncTrigger ( Irpt& i, int n=1 ) trigger an interrupt asynchronously Trigger() is used to trigger interrupts from thread level; aka 'synchronously'. You can trigger an interrupt just once or a precise number of times as you require. If you need to trigger an interrupt from interrupt level or from an 'alien context' use AsyncTrigger() instead. Asynchronous interrupts are deferred until the next time a dispatcher method is called. Then they are handled synchronously. Of course, AsyncTrigger() does not perform a dispatcher test! void Shedule ( Irpt&i ) shedule self for an interrupt void Shedule ( Irpt&i,long dur ) shedule with timeout This call suspends your thread and shedules it for an interrupt. Your thread is resumed, when either of the following occurs: - the interrupt fires - the timeout expires if you have called it with timeout - your thread is resumed from another thread - your thread has been time-sheduled by another thread and timed out; your thread's code should check whether really an interrupt occured.