Proposing to call setlocale( LC_ALL, "C" ) in msSetup()

Umberto Nicoletti umberto.nicoletti at GMAIL.COM
Sat Apr 29 14:19:00 EDT 2006

On 4/28/06, Frank Warmerdam <warmerdam at> wrote:
> Umberto Nicoletti wrote:
> > Hi Frank.
> >
> > First is thread safety: I have read somewhere but I have lost the link
> > that atof is thread safe unless setlocale is called while executing.
> > This could happen if we call setlocale from within gdal and reset it
> > afterwards.
> Umberto,
> This is a good point, and a great danger in the "frequent calls
> to setlocale()" approach to dealing with the issue.
> > Second the Java VM respects the LANG and LC_* variables so changing
> > the locale internally and   for small execution intervals will almost
> > certainly cause incosistent behaviour at different times in the jvm: a
> > number could be parsed in the C locale at one time and in the it_IT
> > another. Even worse this could affect the whole tomcat process which
> > could be running many other apps too.
> I don't think that setlocale() changes the LANG or LC_ environment
> variables.  So it should only affect stuff using the C runtime, not
> JVM stuff that manages it's locale handling separately from the C
> runtime.

no, it doesn't, I wanted to say that the jvm would start in a certain
locale and then switch to another one while running so other
applications under the same jvm will experience funky behaviour and
they might not appreciate that ;-).


> >> I can certainly forsee problems if mapscript is loaded into apache,
> >> in that our setlocale() action may affect all other activity using
> >> the c runtime in Apache.  Is that the sort of issue you are concerned
> >> about?
> >
> > Exactly.
> Of course there is still general danger.
> Best regards,
> --
> ---------------------------------------+--------------------------------------
> I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at
> light and sound - activate the windows |
> and watch the world go round - Rush    | President OSGF,

More information about the mapserver-dev mailing list