Auto disable interrupt port

I’m writing the wiznet driver and I don’t want the system to trigger multiple interrupt threads. So I disable the interrupt port if the thread is currently processing the previous interrupt. However, another interrupt could come in before I manage to disable the port.

Is it possible to have a one shot interrupt? or to disable the interrupt after the first trigger?

:wall: is this a job for ClearInterrupt()?

@ Mr. John Smith -

Have you tried interrupt edge level high or low? Those only fire once until the interrupt is cleared. That being said, are they supported?..(you could try)

From the documentation:

[quote]A level interrupt, which is either an InterruptEdgeLevelHigh or InterruptEdgeLevelLow interrupt, is dispatched when the value on a pin matches the specified high or low value, respectively. The system dispatches only the first occurrence of a level interrupt until it is cleared by means of the InterruptPort.ClearInterrupt method.
With a nonlevel interrupt, every specified edge is dispatched, and the InterruptPort.ClearInterrupt method has no effect.[/quote]

If not, use interruptedgehigh or low, capture the first interrupt, disable the interrupt port, set a flag to skip any possible queued interrupts. Then, when you’re ready for another interrupt, turn the flag off and enable the interrupt again.

@ andre.m how could you do it with a lock?