Paul Eggert wrote: > > POSIX [1] says about localeconv(): > > "The localeconv() function need not be thread-safe; however, localeconv() > > shall avoid data races with all other functions." > > > > [1]https://pubs.opengroup.org/onlinepubs/9799919799/functions/localeconv.html > > > > It's not exactly clear to me what this means. What is relevant for library > > code is that one can call localeconv() and access the elements of the > > result, > > when no other thread calls setlocale() or the same thread does not call > > uselocale(). > > To me it means that if two threads simultanously call localeconv and any > other function (including setlocale and uselocale!), localeconv might > have a data race.
You mean, "localeconv will *not* have a data race" ? > However, if two threads simultanously call localeconv > you might have a data race and the result might not be valid. Yup, that's what I understood. Fortunately the unit test proves that this is a non-issue on the systems in use nowadays. Probably because a data race in localeconv() would lead to an MT-safety bug in *printf, and such a bug would have been detected and fixed over the last 20 years. Bruno