Re: Collation patch's handling of wcstombs/mbstowcs is sheerest fantasy

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Collation patch's handling of wcstombs/mbstowcs is sheerest fantasy
Date: 2011-04-24 23:57:35
Message-ID: 1303689455.5006.18.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On lör, 2011-04-23 at 11:37 -0400, Tom Lane wrote:
> I wrote:
> > * Where they're not, install the locale_t with uselocale(), do
> > mbstowcs or wcstombs, and revert to the former locale_t setting.
> > This is ugly as sin, and not thread-safe, but of course lots of
> > the backend is not thread-safe.
>
> I've been corrected on that: uselocale() *is* thread safe, at least in
> glibc (it only affects the locale used by the current thread). And it's
> "only a few instructions" according to Jakub Jelinek. So a temporary
> setting via uselocale is exactly what you're supposed to do for any
> locale-sensitive function that hasn't got a *_l variant.

Good to know. It was certainly very strange, this gap in the API.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2011-04-25 00:39:56 Re: Some TODO items for collations
Previous Message Peter Eisentraut 2011-04-24 23:56:47 Re: Collation patch's handling of wcstombs/mbstowcs is sheerest fantasy