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

Ole Reinhardt ole.reinhardt at embedded-it.de
Fri Feb 22 12:09:23 CET 2008


Hi,

> Some time ago a contributor suggested a different solution, which is 
> still in arch/h8300/include/atom.h. It adds an opening curly brace to 
> NutEnterCritical and a closing one to NutExitCritical.  The intention 
> was to avoid difficult to find problems due to any missing 
> NutExitCritical(). Btw. that's also the reason for NutJumpOutCritical().
> 
> May be we can use this to add a local variable to NutEnterCritical. This 
> may break some existing code, but avoids re-writing all the critical 
> sections.

That's quick and dirty as well :) And you may never use constructions
like

NutEnterCritical();

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

I realy would prefere to break some code. And rewriting all critical
sections should not be a real problem in the main NutOS code. This could
(nearly) be done by some interactive search and replace. If you search a
volunteer, you have found one, but it must be tested later. A short
statistic shows 115 places where NutEnterCritical is used in NutOS code
(current CVS HEAD). So it's some work but if we stabalize NutOS it would
be worth the trouble.

So I would suggest to leave NutEnterCritical / NutExitCritical and
declacre them as deprecated.

Two new Functions

short flags; 

NutEnterCriticalWithFlags(&flags)
NutExitCriticalWithFlags(flags)

could be created and the NutOS code could be modified accordingly to use
the new functions. So existing applications won't break but the authors
should be warned when using NutEnterCritical to modify there code.

Bye,

Ole

-- 
 _____________________________________________________________
|                                                             |
| Embedded-IT          Hard- und Softwarelösungen             |
|                                                             |
| Ole Reinhardt        Tel. / Fax:        +49 (0)271  7420433 |
| Luisenstraße 29      Mobil:             +49 (0)177  7420433 |
| 57076 Siegen         eMail:    ole.reinhardt at embedded-it.de |
| Germany              Web:         http://www.embedded-it.de |
|                      UstID / VAT:       DE198944716         |
|_____________________________________________________________|




More information about the En-Nut-Discussion mailing list