On Sun, 2009-06-14 at 13:32 +0300, Andrus Moor wrote:
> Very quick look into AttributeMappingSource() did'nt show thread unsafety.
> Is it reasonable to assume undocumented feature that
> AttributeMappingSource() instance member calls ares thread-safe ?
I don't want to require thread-safe code, as writing thread-safe code
can be difficult, and testing code to ensure that it's thread safe is
even more difficult (or impossible, as often times you need a giant
multi-processor box in order to hit some of the erroneous code paths).
The simplest way to make something thread safe is to just make it
immutable (like String), but apparently this isn't possible here (and
even if it were it might require a similarly long time to load up all
the required data).
> Or is it OK to apply patch which uses
>
> lock(this) { .... }
>
> locks to make AttributeMappingSource() thread safe ?
> Or should there be ThreadSafeAttributeMappingSource() class like
> ThreadSafeDictionay is created from Dictionary class in dblinq ?
That would slow things down.
The proper solution is to make AttributeMappingSource lazy. It's
apparently attempting to load everything during initialization, when it
could instead load things on-demand (presumably; I haven't checked the
code). On-demand loading wouldn't overcomplicate testing either.
Thanks,
- Jon
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"DbLinq" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/dblinq?hl=en
-~----------~----~----~----~------~----~------~--~---