[Mesa-dev] [PATCH 02/21] glsl: protect locale_t with a mutex

Kenneth Graunke kenneth at whitecape.org
Mon May 5 00:02:03 PDT 2014


On 05/04/2014 02:14 PM, Chia-I Wu wrote:
> On Sat, May 3, 2014 at 1:52 AM, Ian Romanick <idr at freedesktop.org> wrote:
>> On 04/22/2014 01:58 AM, Chia-I Wu wrote:
>>> There may be two contexts compiling shaders at the same time.  locale_t needs
>>> to be protected.
>>
>> Rather than calling glsl_initialize_strtod from other places in the
>> compiler, it seems better to use call_once from the strtof and strtod
>> functions.
> How about having a static object to call newlocale()/freelocale() in
> its constructor/destructor?  It will impose no overead on
> glsl_strtod(), at the expense of little wasted memory when the
> applications do not compile shaders.

That seems like a good plan to me.  I'm actually kind of surprised that
POSIX doesn't provide a pre-existing locale_t object for the POSIX/C locale.

--Ken

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140505/06f8edd3/attachment.sig>


More information about the mesa-dev mailing list