bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: Date/Number translations


From: Maciej Piechotka
Subject: Re: Date/Number translations
Date: Sun, 20 Jul 2008 19:06:32 +0200

On Sat, 2008-07-19 at 08:55 -0600, Eric Blake wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> According to Maciej Piechotka on 7/3/2008 6:49 PM:
> |
> | Thanks for response. Do setlocale set the locale globally or per-thread?
> | If globally is there any possible of doing it with different locales on
> | different threads or do I need to synchronize it?
> 
> I didn't see an answer to this, so here goes:
> 
> Per POSIX, setlocale() is global (and not thread-safe); it should be done
> prior to creating threads, or you must use careful synchronization between
> threads to ensure that library functions that depend on locale (and there
> are a lot of them) do not inadvertently have the locale changed behind
> their backs by another thread.
> http://www.opengroup.org/onlinepubs/009695399/functions/setlocale.html
> 

I've just used fork and put all synchronisation for system.

> But POSIX 200x is adding a new set of interfaces, modeled after what glibc
> already provides, including uselocale() (set the locale for a given
> thread), newlocale() (create an opaque locale handle), and various *_l
> counterparts that use a locale handle rather than the global state (for
> example, islanum_l instead of isalnum).
> 

Thanks.

> - --
> Don't work too hard, make some time for fun as well!
> 

It easier to say and harder to do.

> Eric Blake             address@hidden

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]