Hi ,
I think , i am myself confused due to contrasting expalantions available
on net but the fact remains that by default coding norms a static
variable can't be thread safe , since it has common access to many
clients but many classes in .Net are by default designed to incorporate
the issue and they have implemented an internal locking using mutex .
you may wnat to have alook through :
-- suggests that static classes are thread safe .
http://dotnet.org.za/armand/archive/...6/10/2080.aspx
-- Articles on thread safety -- more detailed .
http://odetocode.com/Articles/313.aspx http://odetocode.com/Articles/314.aspx -- Talks about internal
implementation of lock .
So , you need to go into a class definition and check out the thread
safety being claimed by MS .
Meanwhile what i think is only Reading is not a problem at all , you may
not do any kind of any locking as it doesn't changes ur variable value .
Moreover locking has it's own performance hits .
For any class if you are doing some modification in value for static
object and it's MS document doesn't claims thread safety , then better
go for ur own implementation , as you can't even isolate the case and
check , as at different times it will yield different results .
thanks ,
Mrinal
The Crow wrote:
no i wont modify parameters, just read it.
can u show me a reference proving that static members are thread safe by
default?