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

Harald Kipp harald.kipp at egnite.de
Fri Feb 22 12:54:10 CET 2008


Ole Reinhardt schrieb:


> NutEnterCritical();
> 
> if (a != b) {
>    NutExitCritical();
>    return;
> } else {
>    Do some stuff here
>    NutExitCritical();
>    Do some more stuff here
> }

It could be done this way:

NutEnterCritical();

if (a != b) {
    NutJumpOutCritical();
    return;
}
Do some stuff here
NutExitCritical();
Do some more stuff here



> So I would suggest to leave NutEnterCritical / NutExitCritical and
> declacre them as deprecated.
> 
> Two new Functions
> 
> short flags; 
> 
> NutEnterCriticalWithFlags(&flags)
> NutExitCriticalWithFlags(flags)

This is definitely attractive, because it would generally simplify 
porting Nut/OS to new platforms. I'd, however, prefer int instead of short.

AFAIK, the problem doesn't exist with AVR. Anyway, we should ask the 
btnode project also about their opinion.

Harald



More information about the En-Nut-Discussion mailing list