Re: locale_to_utf8 multithread



After searching a lot, It seems its the function g_get_charset which have a problem when it run simultaneous in different threads.
If I run g_get_charset once, pass charset variable to threads and use Glib::convert, it works.

2007/6/25, Daniel Elstner < daniel kitta googlemail com>:
Am Montag, den 25.06.2007, 17:36 +0200 schrieb Fabian Jacquet:

> I'm a new user of GLib and I have a problem using locale_to_utf8
> function with multiple threads.
>
> When 2 threads use locale_to_utf8 at same time, I have an access
> violation exception.
>
> Is it a bug or a bad use?
> I simply do this in the threads:
> Glib::ustring name = Glib::locale_to_utf8("valeur avec é etc");

Should be safe.  While GLib does cache and re-use iconv_t descriptors,
it is supposed to be thread-safe.  Are you sure it is really
Glib::locale_to_utf8() causing the access violation?  Can you reproduce
the problem using the GLib C API?

--Daniel





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]