[En-Nut-Discussion] Not fixed!!!: Re: confirmed!!! Re: NutOS 4.4.0 on ARM7: possibly bug in NutEnterCritical / NutExitCritical

Nathan Moore nategoose at gmail.com
Fri Feb 22 17:17:40 CET 2008

Sorry, but I hadn't seen the latest discussion when I wrote my last post, so
I mentioned things that others had already brought up.
Someone said that this wasn't a problem on AVR, but I'm pretty sure that it
is just a lot less likely on AVR.

Another thing that was mentioned was the type used for the state variable. I
think that this should be typedefed by compiler and architecture.  In my
implementation for AVR I did typedef unsigned char Critical, but also
considered making it a struct so that it
would be opaque and harder to accidentally change within other code.  In
addition this would allow a conditionally compiled in
state of the state member of the struct value which could be used along with
assert to help programmers to make sure their critical sections weren't
exited more times than they were entered since many compilers will issue
warnings or errors if they can tell at
compile time that an assertion is false.  By itself this wouldn't keep
someone from not exiting a critical section, but functions and
macros could be added to do this if someone wanted.  This added complexity
would only be an optional addition to help find errors
and would not effect anything if not enabled.


More information about the En-Nut-Discussion mailing list