_REENT_ONLY question

Artem B. Bityuckiy abityuckiy@yandex.ru
Fri Nov 28 20:22:00 GMT 2003


Please, can anybody explain me why _REENT_ONLY macro is needed? For 
what? Why some functions have on implementation and another have pair 
with _r postfix, e.g. setlocale() and _setlocale_r(), etc. Several 
functions have no such pair, e.g. ldiv(). And in all cases (that I've 
seen) usual functions call _r pair adding _REENT argument. For example 
'setlocale(category, locale)' just calls '_setlocale_r(p, category, 
locale), where p is 'struct _reent'. I can only guess that this is 
needed if external (not usual Newlib) "multiprocess support subsystem" 
is used...

Can anybody explain this and give me some examples when "_r" pairs are 
really useful/needed?

Best Regards,
Artem B. Bityuckiy,
St.-Petersburg, Russia.

More information about the Newlib mailing list