[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Date/Number translations
From: |
Eric Blake |
Subject: |
Re: Date/Number translations |
Date: |
Sat, 19 Jul 2008 08:55:34 -0600 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080421 Thunderbird/2.0.0.14 Mnenhy/0.7.5.666 |
-----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
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).
- --
Don't work too hard, make some time for fun as well!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkiCAGYACgkQ84KuGfSFAYB+tgCdFJjePvAo2cWY4W/gHuD6BNzf
Pc8AnRT4HPQFbZikRthroZS/IfUCNHcv
=7qao
-----END PGP SIGNATURE-----