GOTO
, in C, only allows jumps to labels in the same function. So you will not be able to do that. Even if you could it would be a bad idea, Interrupt Handlers must return from their function to end the interrupt, a GOTO is not a function call
You can in principle call the redraw method directly, however this will have the side-effect that you describe - multiple interrupts may "clobber" each other or some other system thrashing.
Interrupt handler should be as small as possible, In this case a simple handler would
- increment the counter
- set a flag (boolean variable) to indicate a redraw is needed
- Alternatively, you can only increment a counter and store the previous value elsewhere for comparison
The main thread would run in a standard while-true-redraw-sleep
loop, you would check this flag every cycle. This way, when multiple interrupts are issued, the counter is incremented multiple times, but the redraw is only triggered when the main thread is ready, in other words the redraw is synchronous with the main thread refresh timer.
A more clever way would be to use events/signals for the refresh. The main thread "sleeps" on an event and is woken by the interrupt handler. This way if there are many events the refresh is triggered as often as it can be, but if there no events it is idle. This makes the refresh synchronous with the interrupt.
Regardless
The key is that no drawing code is done in the interrupt context. You need to think of a way to indicate that a redraw is needed. The redraw happens in the GUI thread.