[En-Nut-Discussion] NutEnterCritical vs NutEnterCriticalAccess()
Uwe Bonnes
bon at elektron.ikp.physik.tu-darmstadt.de
Wed Nov 18 10:55:43 CET 2015
>>>>> "Nathan" == Nathan Moore <nategoose at gmail.com> writes:
Nathan> How about something like the following for each target cpu?
Nathan> #define NutCriticalUpdate( VARIABLE, VALUE) \ do { \ size_t sz_
Nathan> = sizeof(typeof(VARIABLE)); \ size_t sza_ =
Nathan> sizeof(sig_atomic_t); \ typeof(VARIABLE) * VP_ = &(VARIABLE); \
Nathan> typeof(VALUE) VAL_ = (VALUE); \ if (sz_ == sza_ &&
Nathan> is_alligned(VP_) { \ *VP_ = VAL_; \ } else if (sz_ < sza) { \ /*
Nathan> special consideration for cpu */ \ } else { \
Nathan> NutEnterCritical(); \ *VP_ = VAL_; \ NutExitCritical(); \ } \ }
Nathan> while (0) _______________________________________________
This sounds interesting however:
- This is a GNU extention, and so deprecated for common code
- This only on direction, for writing the variable and more code for reading the
variable is needed.
Bye
--
Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt
--------- Tel. 06151 1623569 ------- Fax. 06151 1623305 ---------
More information about the En-Nut-Discussion
mailing list