[RFC]setlocale() race condition
Carlos O'Donell
carlos@systemhalted.org
Thu Jun 12 14:00:00 GMT 2008
On Wed, Jun 11, 2008 at 11:45 PM, Sharyathi Nagesh <sharyath@in.ibm.com> wrote:
> Since the man page of setlocale() doesn't talk any thing about the
> call `not being re-entrant` I assume setlocale() to be re-entrant
setlocale() is not on the POSIX.1 list of async-signal safe functions
and is therefore not re-entrant or thread-safe.
http://www.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html#tag_02_04
Please note that re-entrancy and thread safety are related but
different terms. A re-entrant function need not be thread safe,
imagine two threads passing in the *same* structure to a re-entrant
function, without synchronization access to the structure is
unpredictable. A non-re-entrant function may be thread safe if access
to the global state is synchronized.
Are you suggesting that setlocale() although not re-entrant, should be
made thread safe according to the standard?
Cheers,
Carlos.
More information about the Libc-help
mailing list