[Mono-devel-list] [PATCH] Reworked unified Locale classes

Kornél Pál kornelpal at hotmail.com
Wed Jun 15 16:32:44 EDT 2005


> Try using [ThreadStatic], it's a bit cleaner.

I will examine the documentation regarding this attribute because I did not
know it.

Note that this is required only by corlib to prevent infinite recursion
because Locale.cs uses itself in fact. Normally recursion should not happen
but if something goes wrong and ResouceManager or any other object it uses
throws an exception it will call GetText inside GetText and this will result
in an infinite loop unless it is prevented.

So I think this protection is necessary but cannot be done using a static
lock because it would degrade the performace of the whole CLR.

By the way if doing this causes performance loss and you (or anyone else)
have a better solution to prevent infinite GetText recursion I am open to
new ideas.

> After that, we have to look at how much extra code this brings on
> startup. Give me a day or two for this (sorry about the delay ;-().
> However, given that the infrastructure is much more cleaned up, it
> should be easier for you to work on stuff.

Ok, I understand it because the current implementation does nothing in fact
so this is a big change.:)

> I hope I am not blocking your work.

I have changed some things but the concept is the same in for handling
resources in gettext () style since my first patch posted for Locale.cs a
week ago so Locale.cs does not block me it's complete and I modified only
things that I found inefficient because exept your above suggestion about
[ThreadStatic] I did not receive any comments regarding Locale.cs itself.

The thing that blocked me was the procedure (moving Locale.cs files to a
central location and the bunch of diff files I posted after testing) that
lead to this step that I wanted from the beginning to review my patch and
comment it.:)

Kornél




More information about the Mono-devel-list mailing list