Re: Gtk+ print support - request for feedback
- From: Michael Sweet <mike easysw com>
- To: Morten Welinder <mortenw gnome org>
- Cc: gtk-devel-list gnome org, alexl redhat com
- Subject: Re: Gtk+ print support - request for feedback
- Date: Mon, 06 Mar 2006 10:03:37 -0500
Morten Welinder wrote:
The man page for setlocale() says nothing about thread safety, but
given how all of the other standard C calls work I'm frankly shocked
that setting the locale in one thread affects the others. Is this
just a bug on Linux, or is it a general problem on other operating
systems?
Solaris' man page says...
-----------------------------------------------------------------------------
NOTES
To change locale in a multithreaded application, setlocale()
should be called prior to using any locale-sensitive rou-
tine. Using setlocale() to query the current locale is safe
and can be used anywhere in a multithreaded application.
-----------------------------------------------------------------------------
Note, that the effect is not just that the other thread might see
a locale changed. Pointers they got from localeconv or setlocale
might turn invalid underneath them. Or code they were running
might be unmapped. (After all, shared libraries uses as plugins
are a common way of dealing with locales.)
The unfortunate effect is that sscanf is not going to be useful
for a library. Unless you are willing to fork() but that comes
with its own set of problems.
Well, fuck, so much for the CUPS 1.2 beta release today...
I'll make sure we reduce our use of setlocale() to query-only and
add all sorts of wrapper crap to "fix" things for non-POSIX locales
as needed. One of the big new things for CUPS 1.2 is thread-safety,
so this is a show-stopper... :(
FWIW, I filed this issue as STR #1463, accessible at:
http://www.cups.org/str.php?L1463
Please feel free to post suggestions, code, etc. that we can use.
--
______________________________________________________________________
Michael Sweet, Easy Software Products mike at easysw dot com
Internet Printing and Document Software http://www.easysw.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]