Re: Gtk+ print support - request for feedback
- From: mortenw gnome org (Morten Welinder)
- To: mike easysw com
- Cc: gtk-devel-list gnome org, alexl redhat com, mortenw gnome org
- Subject: Re: Gtk+ print support - request for feedback
- Date: Mon, 6 Mar 2006 09:41:42 -0500 (EST)
> 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.
M.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]