After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 658683 - clean up charset/language threading issues
clean up charset/language threading issues
Product: glib
Classification: Platform
Component: general
Other All
: Normal normal
: ---
Assigned To: gtkdev
Depends on:
Reported: 2011-09-09 22:34 UTC by Allison Karlitskaya (desrt)
Modified: 2011-09-10 00:34 UTC
See Also:
GNOME target: ---
GNOME version: ---

Clean up l10n threading stuff (3.72 KB, patch)
2011-09-09 23:50 UTC, Allison Karlitskaya (desrt)
committed Details | Review

Description Allison Karlitskaya (desrt) 2011-09-09 22:34:04 UTC
The functions g_get_{charset,filename_charsets,language_names} all return constant strings that they cache on a per-thread basis (to facilitate changing the locale).

These functions are currently called from g_thread_init() to get themselves initialised in a guaranteed single-threaded environment.  This is probably a good idea since they interact with the somewhat thread-unsafe libcharset code that we have in-tree.

We need to clean this up a bit...
Comment 1 Allison Karlitskaya (desrt) 2011-09-09 23:50:56 UTC
Created attachment 196154 [details] [review]
Clean up l10n threading stuff

Remove the explicit thread initialisation functions for g_get_charset(),
g_get_filename_charsets() and g_get_language_names().

Add a lock around one remaining case of access to libcharset (the other
2 cases already have the lock).

Do a proper g_once_init_enter() style initialisation for the GLib
gettext functions.
Comment 2 Matthias Clasen 2011-09-09 23:58:35 UTC
Review of attachment 196154 [details] [review]:

Looks obvious enough. Did you want to replace that unalias call in gutf8.c as well, or has that already happened ?
Comment 3 Allison Karlitskaya (desrt) 2011-09-10 00:19:21 UTC
didn't do anything yet.  was trying to keep the patch minimal.  shall i submit a separate patch?
Comment 4 Matthias Clasen 2011-09-10 00:20:34 UTC
separate patch sounds great
Comment 5 Allison Karlitskaya (desrt) 2011-09-10 00:34:50 UTC
the hashtable maps canonical names to list of aliases for that name

the function below is trying to turn an alias into a canonical name.  so we can't use the hashtable for that.  therefore: no new patch.