Why not Threadsafe Access to List?

Why not Threadsafe Access to List?

Old forum URL: forums.lhotka.net/forums/t/4205.aspx


jh72i posted on Tuesday, January 22, 2008

Rocky, you may have answered this before but I just couldn't find a reference.  I'm at the stage of looking at the latest CSLA and relating it to work I have done to enhance and use a very early version. 
I'm just (re-)wondering why you didn't consider making this later version thread safe in terms of accessing the contents of the List in your collections.  This is not a criticism just a pondering whether there is some very clear reason why not.

thanks.

ajj3085 replied on Tuesday, January 22, 2008

I think he's stated performance is the main reason.  he's also taking a que from the framwork itself, where static methods will be thread safe, but instance members will not.  If you need thread saftey, your application will have to code the appropriate locks.

RockfordLhotka replied on Tuesday, January 22, 2008

Exactly.

jh72i replied on Tuesday, January 22, 2008

I've always thought that was the main reason but thanks for reiterating.
 
As an aside I'm not sure its possible to wrap all the functionality necessary in subclasses - for full thread safety you'd have to lock each iteration of/access to the List but not all methods/etc. are virtual/non private/etc.
 
 

Copyright (c) Marimer LLC