[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: AW: [avr-gcc-list] reentrant interrupt service routine
From: |
Pink Boy |
Subject: |
Re: AW: [avr-gcc-list] reentrant interrupt service routine |
Date: |
Tue, 1 Apr 2008 21:33:27 -0700 (PDT) |
Sven Schlender sez,
> So far I know. There is another (or maybe the same) problem I
> think about. Lets say there is function which is callable
> from main() AND from any interrupt routine.
Aiiiiggggggghhhhhh!
Such a thing is safe as long as the function is truly reentrant.
That is only operates on local and passed variables. IE, no
global variables, and in that case it's very safe.
It's not that unusual for library routines to be not thread safe.
And for a number for compilers I've dealt with, floating point
operations were not reentrant safe and in one case long division
wasn't safe either.
If global variables are accessed then the access must be
protected. For simple things the hack I use is
uint8_t sreg = SREG;
cli();
/* do something to a global data structure that
doesn't take too long */
SREG = sreg;
And at the end when you set SREG back to whatever it was, you'd
better leave the global data structure in a safe state as the end.
Mr Foo
- [avr-gcc-list] reentrant interrupt service routine, Sven Schlender, 2008/04/01
- RE: [avr-gcc-list] reentrant interrupt service routine, Weddington, Eric, 2008/04/01
- Re: [avr-gcc-list] reentrant interrupt service routine, Jan Menzel, 2008/04/01
- AW: [avr-gcc-list] reentrant interrupt service routine, Sven Schlender, 2008/04/01
- Re: AW: [avr-gcc-list] reentrant interrupt service routine,
Pink Boy <=
- Re: AW: [avr-gcc-list] reentrant interrupt service routine, Dmitry K., 2008/04/02
- Re: AW: [avr-gcc-list] reentrant interrupt service routine, Mark Litwack, 2008/04/02
- Re: AW: [avr-gcc-list] reentrant interrupt service routine, Mark Litwack, 2008/04/07
- RE: AW: [avr-gcc-list] reentrant interrupt service routine, Weddington, Eric, 2008/04/07
- Re: [avr-gcc-list] reentrant interrupt service routine, hutchinsonandy, 2008/04/07
- Re: [avr-gcc-list] reentrant interrupt service routine, Bernard Fouché, 2008/04/07
- RE: [avr-gcc-list] reentrant interrupt service routine, Weddington, Eric, 2008/04/07
- Re: AW: [avr-gcc-list] reentrant interrupt service routine, Mark Litwack, 2008/04/07
- RE: AW: [avr-gcc-list] reentrant interrupt service routine, Weddington, Eric, 2008/04/07
Re: [avr-gcc-list] reentrant interrupt service routine, Joerg Wunsch, 2008/04/02