2012/3/27 Mason <[email protected]> wrote:

> Neither atoi nor strtol are mentioned in the list, therefore atoi
> and strtol must be thread-safe on POSIX-compliant implementations
> (otherwise it's an implementation bug, which may happen).
>
> Are you saying atoi is not thread-safe because it might call
> isspace, which might be affected by setlocale?

>From a practical point of view, whether atoi() is thread-safe and
async-cancel-safe should be considered as being implementation
dependant. On the safe side, not thread safe. POSIX may dictate
whatever they choose, but software has bugs and not all
compilers/libraries pass same QA tests.

atoi() is one of the functions that should have been dropped in POSIX
SBS issue 7. There's no way to tell apart a 'proper' zero result from
a 'bad' zero result. http://www.codepolice.org/c/atoi.html

Regarding lwIP getaddrinfo() thread-safeness, let's stop this here.
Ask the lwIP Team to document whether lwip_getaddrinfo() is
thread-safe or not and we'll adapt if it is documented to be
thread-safe and its implementation removes atoi() usage.


-- 
-=[Yang]=-
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to