|
From: | Bernard Fouché |
Subject: | Re: [avr-gcc-list] use of GOTO statement |
Date: | Thu, 11 Aug 2005 23:02:28 +0200 |
User-agent: | Mozilla Thunderbird 1.0.2 (Windows/20050317) |
Anyway there are tiny os's that should do that and I would look in that way if I were looking for such a feature. But I expect that in this case the CPU is made to point at another stack frame (one for each process/task) with some asm code. Or maybe with setjmp()/longjmp() ?
Bernard address@hidden wrote:
*If you want the non-interrupt software to change what it is executing based on getting/processing an interrupt, then the C language goto is not the correct concept. The common way to do what you want is to implement a finite state machine in the non-interrupt section of your system software. The interrupt service routines set flags or other mechanisms and exit the interrupt as usual. The non-interrupt code looks at this variable and branches accordingly. The non-interrupt level code also disables interrupts briefly while altering this variable to provide mutual exclusion with an interrupt routine which may alter this variable. An Interrupt routine could alter the return PC, but this is poor form and will very likely lead to an unreliable design.*
[Prev in Thread] | Current Thread | [Next in Thread] |