lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Wed, Jun 22, 2011 at 10:09 AM, Roberto Ierusalimschy <[email protected]> wrote:
> On Tue, Jun 21, 2011 at 6:21 PM, Luiz Henrique de Figueiredo
> <[email protected]> wrote:
> > Lua 5.2.0 (beta-rc2) is now available at
>
> Do the new setlocale calls in ldo.c change thread safety assumptions
> Lua?  http://stackoverflow.com/questions/4057319/is-setlocale-thread-safe-function

It seems so :(

Suggestions?


I think there's no easy way. On posix systems you can use newlocale / uselocale / freelocale to change it per-thread [1]
On Windows you have SetThreadLocale [2]. So, changing locale in a thread safe way is not portable. Some #ifdefs will be needed.


[1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/uselocale.html
[2] http://msdn.microsoft.com/en-us/library/dd374051(v=vs.85).aspx